Adding fields with £ signs
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Adding fields with £ signs
Wonder if someone can help.
I'm working on a commission calculator and want certain fields with numbers in them to show the £ sign. The problem is, I use the fields with £ signs to + and subtract with other fields with £ signs and when I get a coding error which I assume is because Rev sees the £ sign as not a digit!
How do I get around this?
Cheers
Dan
I'm working on a commission calculator and want certain fields with numbers in them to show the £ sign. The problem is, I use the fields with £ signs to + and subtract with other fields with £ signs and when I get a coding error which I assume is because Rev sees the £ sign as not a digit!
How do I get around this?
Cheers
Dan
Re: Adding fields with £ signs
Hello Dan,
why you do not add and remove the british pound sign before you do the calculation?
Robert
why you do not add and remove the british pound sign before you do the calculation?
Robert
Re: Adding fields with £ signs
I have tried this using code:
However, I then have to use field C to + to field D but as the £ is in field C I get a coding error
Code: Select all
put "£" & field "A" + field "B" into field "C"
Re: Adding fields with £ signs
Dan,
you could take out the £ sign temporarily.
regards
Bernd
you could take out the £ sign temporarily.
Code: Select all
put field "x" into tData
replace "£" with empty in tData
put tData + tWhatToAdd into tData
put "£" && tdata into field "result"
Bernd
Re: Adding fields with £ signs
It might be easier to manage if you use a function when this arises:
So you can say get "£" & goodNumber(firstData) + goodNumber(secondData).
This makes sure that ANY errant character that might hang rev up is eliminated. I get these now and then due to typos, some of which are invisible.
Craig Newman
Code: Select all
function goodNumber tText
repeat for each char theChar in tText
if theChar is in ".0123456789" then put theChar after temp
end repeat
return temp
end goodNumber
This makes sure that ANY errant character that might hang rev up is eliminated. I get these now and then due to typos, some of which are invisible.
Craig Newman
Re: Adding fields with £ signs
That seems are better way thank you Craig.
Are you saying to place this script in the stact script, therefore whenever there is a £ sign in fields that are involved in calculations with other fields that have the £ sign then the stack script will mitigate any code errors and the £ sign will be ignored?
Cheers
Dan
Are you saying to place this script in the stact script, therefore whenever there is a £ sign in fields that are involved in calculations with other fields that have the £ sign then the stack script will mitigate any code errors and the £ sign will be ignored?
Cheers
Dan