Forum Discussion

patan's avatar
patan
New Contributor III
5 years ago
Solved

Using the parsed Float value in string

I have double value coming from the source as a string. Source value: “NTGEW” : “3.400” I am using parseFloat() function to convert the string into double value. parseFloat($NTGEW) ===> 3.4 ...
  • lazo_ilijoski's avatar
    5 years ago

    Maybe initially I didn’t understand well your issue.
    You can use the following statement with regex:
    "Input Value “+ ((parseInt($NTGEW) == parseFloat($NTGEW)) ? parseInt($NTGEW).toString() : (parseFloat($NTGEW).toString()+“0”).match(”(.*d?[1-9])0+$")[1])*

    So, I did tests with few cases and got the following result:

    And here is updated pipeline:
    floatIssue_2020_10_08_v2.slp (5.2 KB)

    Please let me know if this version works as expected.

    /Lazo