Converting Text to number

When calling an API using a connection I get a string back.
I want to convert this string to a number, since i need to do calculations with this number.
I´ve read multiple posts on the forum about using an automation flow to convert this, but I still don´t fully understand how it works.

Right now I store the strings that I want to use in a data item, but when i try to convert them using an automation flow → webAPI then I can’t use data item as input.

So my question is, when converting using an automation flow, how do I select my input?
And it says to make a call to my own api call. But do i make a call to the automation flow or to the flowpart that gets me my initial data?

Thanks in advance,

Hi Lode,

Maybe I can help, since I have implemented this actively and I can share this with you as an example.

My situation is the same: I have numerical values, that I receive as text values and I need to convert them to numbers. So what I did was the following:

  1. I have created an automation flow of the type WebAPI.
  2. I have defined 4 (in my case) input parameters of the Number type.
  3. I added an empty operation (NO OPeration) to add the necessary content to the automation flow.
  4. Next, I have added the same attributes I defined as input parameters also as output parameters, also numerical.
    So the entire flow now looks like this:

So now I have created an API within my own environment, that receives numeric values and gives them right back as a response. The thing is, that Triggre handles numerical text values as numerical values when received through the API. So when I now call this API from a flow part, using a number as text values as input, it will return these values as numerical values, that I can use in the rest of my user flow. This works as follows:
5) Create a flow part to convert the values you want, in my case the flow part has (among other) 4 text input parameters.

:exclamation: Depending on your circumstances, check Tips 1 and 2 below.

  1. Call your own webservice using a WebAPI POST request, with the text values in your flow part.

    Notice that the values in the message have a Text format. Triggre will recognize these values as Numerical and accept the request. The webservice will do nothin more than return the numerical values as a response.
  2. Define the response as returning numerical values
  3. Assign the response values as output parameters to your flow part.
    Now you can continue your process, using the numerical values.

TIP 1: If necessary check beforehand if the values are indeed numerical, using the function IS NUMERIC in a calculation.
TIP 2: If necessary (depending on your local settings) replace the thousand separator with a comma and the decimal sign with a period.
This is necessary if European number notations are used (1.000,00). The Triggre default setting is US (1,000.00). json standards usually use US notations.

Hope this helps! If any questions, please let me know.


Thanks @sylvester!

That is indeed how to work around the situation until we implement the necessary functions.

Small interesting fact: the default number scheme depends on which data center you are hosted in. For US customers, we host in the US and they get the US formatting.

For subscriptions in the EU, which are hosted in the EU data center, the default is the European formatting.

Should you ever want to change it, we can, it is just not a setting that is available in the application settings (yet).

This was released in early 2023, see these release notes.

In addition to my previous answer, something else came to mind later.

You mentioned that you are calling an API that returns numerical values as strings.

When receiving them from an API, you could also define them as numerical directly in your response definition. That way, they will be available as numerical values right away, without the need to define an additional API to convert them.

1 Like

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