You are viewing limited content. For full access, please sign in.

Question

Question

Workflow's Token Calculator - can it calculate how many digits in a number?

asked on March 7, 2016

How can I get Workflow's token calculator to take a value and count how many digits are in that value, then create another number from the result?  Examples:

  • take value of 998050 and get a result of six digits, then take the number 1 and add six zeros to create the new token value of 1,000,000.
  • take value of 98050 and get a result of five digits, then take the number 1 and add five zeros to create the new token value of 100,000
  • take value of 8050 and get a result of four digits, then take the number 1 and add four zeros to create the new token value of 10,000
  •  

I can't seem to figure out how this CountNumber formula works or even if I'm on the right track here.

Thx, Connie Prendergast, Flagstaff County, AB Canada

0 0

Answer

SELECTED ANSWER
replied on March 7, 2016 Show version history

Yeah, sorry - I wasn't paying attention when I pasted in your variable and missed the opening and closing parens.

You should be able to use POWER(10,LEN(%(Significant Digits)))

Power just raises a number (x^n) so since we know the number of digits it's easy to just raise 10 to that number (effectively adding a zero for each digit that LEN calculates).

But again - make sure the variable you are passing is the full number, not the number of significant digits. (You may want to rename that variable for clarity.)

1 0
replied on March 7, 2016

Oh!!  That does seem to have worked!  Thanks a lot, Geoffrey!

0 0

Replies

replied on March 7, 2016 Show version history

How about this: POWER(10,LEN(%Significant Digits))

Just make sure you use the real number for the variable - not the number of digits. LEN will do that for you.

0 0
replied on March 7, 2016 Show version history

Thanks, Geoffrey.  It's not working as is.  I think part of it is because the brackets aren't quite right.  The token is %(Significant Digits) and yours shows it without the bracket between the % and Significant.  I've cut & pasted yours in exactly (no go), changed where the second opening bracket is (no go) and tried using the Power formula in my token calculator (no go).   Can you suggest what needs to be tweaked here to make mine work? 

What is the Power formula trying to do in this scenario? I've figured out the LEN and that part is definitely a piece of the puzzle I want! (string length)

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.