Thanks:  0
Likes:  0
Dislikes:  0

1. ## Digits after decimal

Hello

I need guidance with the following: I am comparing a calculated value against the value calculated by the application using checkpoint.

The actual value in the application is \$50.40

in the calcuation I am getting \$50.4("\$"&(25.2x2)what function should I have to use to have my calculation to consider 2 digits after calculation, and if there is one digit after the decimal point, add one zero

Thanks

2. ## Re: Digits after decimal

Use Round Function the actual Vlaue like Round("\$50.40")= Result vlaue is 50

the expected value also use round function u will get the result like as actual value

compare both expected value and actual value

3. ## Re: Digits after decimal

Use CCur() to cast your value to a currency type. Use FormatCurrency() to output a formatted string. See the WSH 5.6 docs.

4. ## Re: Digits after decimal

Thanks for the input, it works fine when the calculation amount is xx.x format, but when the amount is morethan 1000.2(xxxx.x) the formatcurrency returns \$1,000.20, but in my application the total is displayed as \$1000.20 (without the comma after \$1)and the checkpoint fails, how do I format the total from the calculation to match the one in the application.

5. ## Re: Digits after decimal

Simple. Just verify if thers is comm or not before comparing the value. If there is a comma then use Replace function with nothing.

</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">iAmount=&quot;\$1,000.20&quot;
if Instr(1,iAmount,&quot;,&quot &gt; 0 then
iAmount=Replace(iAmount,&quot;,&quot;,&quot;&quot
else
iAmount=FormateCurrency()
End if</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Now compare the value

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.