on 09-17-2008 3:27 PM
Hello,
I am working on a report that has an alpha field in this format:
00-00-00
The users insert numbers where the 0s are. What I need to do is to add the values in the 3 columns. So for example:
03-03-03
A total of 9.
Any ideas on how to approach this? thanks
David
As long as your format is always "##-##-##", and there will always be digits and no alpha or special characters in between the hyphens, then this logic will work for you:
local stringvar input := {table.field};
local stringvar array parts := split(input,"-");
val(parts[1]) + val(parts[2]) + val(parts[3])
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If this is consistently the format and there is never any difference...
Use the LEFT function to pull the first two
//{@GetLeftTwo}
tonumber (LEFT(,2)) The MID function to get the digits in the middle: //{@GetMiddleTwo} tonumber(MID(,4,2))
The RIGHT function to get the last two digits:
//{@GetLastTwo}
tonumber (RIGHT(,2))
Then simply do a formula to add all three:
//{@SumThemAll}
{@GetLeftTwo} + {@GetMiddleTwo} + {@GetLastTwo}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.