Flow Designer, issues with using IF branch and currency field

David141
Tera Contributor
Hello everyone.    On my form I have a currency field and in the Flow Designer I added an IF branch.  IF (datapill to currency field) GREATER THAN 250000 { do stuff}
This works fine for amounts 0 to 999999 but as soon as an extra digit is added, it follows the false branch. So if 1,000,000 is in the currency field it goes to the false branch and I can't figure it out.  I can't script anything in the IF action so really not sure where to go from here besides just changing the field to a decimal field.
4 REPLIES 4

David141
Tera Contributor

Talking to HI support, they stated the below (in case anyone else runs into this)

Methods such as getValue() and getCurrencyValue() return unformatted numbers as strings. The floating point value can be obtained by using the JavaScript function parseFloat(). The resulting value can be used to perform calculations. The currency associated with these values can be obtained by the APIs that return the currency code. You can also use the getCurrencyCode() methods to determine a field's currency. var rate = parseFloat(current.base_rate); var currencyCode = current.base_rate.getCurrencyCode();

I can't create a custom scripted action as it requires a integration hub license and we aren't licensed for it so as a workaround and to keep my sanity I changed the fields to a float and the comparison works as expected.

David141
Tera Contributor

Just want to update that when I went back to this and tried some other numbers, it was doing it's old behavior so I don't think the work-around I said worked actually worked.  The oob IF activity seems to be doing a string compare no matter what the fields are.  Anyways, I got tired of messing around with it and decided to go the workflow route.

Any chance you can use the inline scripting? Example (click the Fx icon next the field you want)

var floatval = parseFloat(fd_data.trigger.my_amount;
return floatval;

Unfortunately the If activity doesn't let you do inline scripting, and as we only have the base integration hub I can't do a custom activity so it looks like making a workflow is how I need to proceed in this case.

 

find_real_file.png