Convert Text To Number


I’m receiving a number as a text response from an API. I want to perform calculations with this number, so I need to convert it from text to a numeric format. What would be the best way to do this?

Thanks in advance for the help.


Hi Melissa,
Currently there’s no function in Triggre itself to convert from Text to Number.
What I normaly do is create a seperate (importable) data item with two properties, a number in one property and a text in the other. I import an Excel with a list of numbers.

After receiving the interface message you do a look-up to the data item with the ConvertTextToNumber and filter on the received text. That will give you that text as a number, as a result of the look-up, to use in your flow part.

Assuming you have tried to receive the number as a text (I don’t think it works, but it might), here’s a trick that should work.

You can use the incoming Triggre WebAPI, since it allows for numbers as texts. See How to create an incoming Web API | Triggre Knowledge Base for the supported formats.

Solution steps:

  1. Receice the number as a text from the 3rd party API.
  2. Call your own WebAPI which has as input a number, but send it the text you received. Out put the number (you will need to put an action in between, though it doesn’t need to do anything).
  3. You now have the text converted to a number.

I haven’t tested this; so there’s a bit of disclaimer on it. However, this is the documented behavior and I personally checked these docs with the developer who built this feature :blush:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.