Code Expression - Rounding Off
Hi all
Using below code express I was able to validate that value in field 2 is 25% of value in field 1.
aqConvert.VarToStr(Aliases.TransactConsole.omTransactFormWizardView.PanelDataEntry.PanelForm.FormTaxFreeWithdrawal.PanelMain.ScrollBoxAroundForm.PanelTFCFacInfo.GroupBoxTFCFac.EditFundValueFac.wText*0.25)
The above code works fine however the issue is when it comes to rounding off the value. Can someone please guide me on how do I round off the results
Example:
The value is 3798.415 and I would want to round it off to 3798.42
Thanks
Gary
If it's DelphiScript that you're coding on, you can use the Round function but after a bit of mathematical manipulation.
So... got to brush off my math undergraduate degree a bit.
Round(Aliases.TransactConsole.omTransactFormWizardView.PanelDataEntry.PanelForm.FormTaxFreeWithdrawal.PanelMain.ScrollBoxAroundForm.PanelTFCFacInfo.GroupBoxTFCFac.EditFundValueFac.wText * 25)/100
Basically, taking the value of field one, multipliying by 100 to move the decimal point then multiplying by 0.25 (net multiply by 25). Then, using the Delphi Round method available in TestComplete to round to the nearest integer...then dividing by 100 again to get the decimal point.
Give this a try.