Convert text to number

2 posts / 0 new
Last post
Mac
Offline
Joined: 01/15/2020 - 11:50
Convert text to number

Hi everyone,
 
I'm new on IDEA and I'm doing my first scripts.
I would like to convert a string into a number format as for example "102.23", I found the function @Val but this one only works on the first figures: @Val(102.23) returns 102.
I could combine this function with the function Split to work arround the coma, but it should exist a simpler method, and I can't find it.
Which funtion should I use?
 
Thank you very much for your help
 
Mac

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Mac,

Are you doing this in IDEAScript or the Equation Editor.  In IDEAScript Val("102.23") should return the decimals.  It should also work for the Equation Editor, just make sure that the field you create has two decimals, if you leave it to the default you will loose the decimal and that might be what is happening in your case.  Also since it is a string you are converting it would have to be within double quotes @val("102.23") .  Hopefully this helps you out.

Brian