How to convert text to int?


How do I get just the number out of a text variable? I am gettingĀ {"Id":25,"ID":25} out of the text variable, and I just need the 25.

When I try to use "Convert Value" to go from text to a number variable, I am getting "Input string was not in a correct format." error.


4 replies

Userlevel 7
Badge +17

It seems to be some sort of a collection. So what you should do is to use "Get element from collection" action and then configure it to retrieve element with the index=0. You can then save it to the variable that is a "number" type.

Regards,

Tomasz

When I do that, I get "Data type returned from the collection is incompatible with the output variable to store the result in."

Userlevel 7
Badge +17

Then use a text variable, after the action log to the history what is the value of that variable and if needed (and if you are sure this is an integer indeed), you can then use "convert" action.

Regards,

Tomasz

Badge +4

Hi,

maybe before loop of the collection remove all empty elements from collection.

Or when you use foreach loop, are you able to log all elements from collection to WF history?

Reply