Unable to compare two variables of type double

Hi Friends,

I am working on a reconiliation process, i need to compare the amount in bank statement which is of double datatype with the amount in recon sheet. The value in bank statement is 123.40 and value in recon is 123.4, when i write an update statement by picking the value from reconsheet and compare with bankstatement it does not update due to the difference in .40 and .4 , can someone help me how to handle this?

Update [Bank Statement$] SET [Reconciled]=‘Yes’ where [Transaction Type]=‘Electronic Debits/Bank debits’ and ([Dollar]=‘123.4’ or [Dollar]=‘-123.4’ ) and ([Reconciled] is Null OR [Reconciled]=‘’ OR [Reconciled]=‘’)",

Check this out… .net - To display Number With 2 Decimal Places - Stack Overflow

Format(datarow("field"), "N2") ' for 2 decimal places

Thanks sir, however i used below option and that fixed my issue
Final amount = String.Format(“{0:0.00}”,Variable1)

Variable1 is of double datatype
Final amount is a string variable

1 Like

Hi @RenukaRPA

You can do the comparison after parsing the second value to double. It will compare without considering the trailing zeros.

(firstValue == Double.Parse(secondValue)).ToString()

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.