Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

adding numbers - problem with comma

Former Member
0 Likes
912

Hi folks,

I am trying to add two numbers in my code and some times the numbers have comma in them. For example the value 25.00 I have has 25,00. Now when I execute my program I am getting an error saying the numbers are not according to the standards of number formats.

Can someone please let me know how can I solve this problem. Thanks

1 ACCEPTED SOLUTION
Read only

abdul_hakim
Active Contributor
0 Likes
845

hi

try using the below code.

data: comma value ',',

deci value '.',

string(8),

string = '25,00'.

<b>replace comma with dec into string.</b>

Cheers,

Abdul Hakim

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
845

You need to get rid of the commas in your fields that you want to add together. You can do that, with two lines of code.

translate v_field using ', '. 
condense v_field no-gaps.

Regards,

Rich Heilman

Read only

0 Likes
845

Didn't realize that we were talking about decimal separator, in that case, it is almost the same.



translate v_field using <b>',.'</b>. 
condense v_field no-gaps.


Regards,

Rich Heilman

Read only

0 Likes
845

Hi Rich,

For example I have the value 25,00 in the field 'Mvalue'. Where 25,00 actually means 25.00. Now I want to change the value in the field 'Mvalue' from 25,00 to 25.00.

Please help me.

Read only

0 Likes
845

The code in my last post should work for you. In my first answer, I was thinking that you needed to get rid of the comma because it was a thousands separator. I guess I didn't read your question carefully.

Regards,

Rich Heilman

Read only

abdul_hakim
Active Contributor
0 Likes
846

hi

try using the below code.

data: comma value ',',

deci value '.',

string(8),

string = '25,00'.

<b>replace comma with dec into string.</b>

Cheers,

Abdul Hakim