Text to number calculation


I make use of a webservice to import some data. One of the datafields is a datafield in the format :“2023-04-28T08:56:00” Which looks similar to RFC3339 triggre supports. but it misses the ‘z’ in the end. import fails.

I have imported as text which works, but its not a date type. I would like to transform this into a date. I can find documentation to make a data into text. but not the other war arround. Even experimented with “add day, add month, add year” calculations but these require a nr. not text.

then text to number then… cant find that either…

Last resort would be to make a lookup table with text and number with same values in it… (must be simpler then that…).

As a beginner, i assume i missed something simple. Any help appreciated

Hi @roland.beernink,

Thanks for reaching out!

We will look into whether the omitted z at the end (which indicates it is a time without any time zone offset) will be something we should accept as input.

In the meantime, I could think of the following workaround you can try:

  1. Create a Web API automation flow, which takes a date as input, and then returns that same value as an output (you may need a flow part in between).
  2. Get the date as a text from the API(as you said you do now), then append a z to it in a calculation action.
  3. Call your newly created Web API, sending as input the new date string (so your application will call its own Web API).
  4. You get the date back from the API, so you can now store it as a date.

Big disclaimer: I have not tested this and it may not work :blush:

Thanks Jesse,

Will give it a try.

1 Like

I can confirm creating the webapi automation flow with a simple text combination works.
To compensate for a timezone difference i needed to change the “Z” into “.52+02:00”

Not sure yet what the impact on “actions” will be as it will be repeated for each item in the initial web service insert.

1 Like

Hi @roland.beernink,

Glad to hear it works. As for the number of actions; it should be:

number of items inserted X number of actions in flow part in automation flow

Assuming you only added 1 flow part, with 1 action, that would be an extra 1x the number of items. Plus the Web API action to call your own API, comes to 2x the number of items in extra actions.

I think you don’t need to really do anything in that automation flow, so you can do with 1 useless action (e.g. a calculation that gives you any specific value, such as the number 42). The reason you need 1 action is the Triggre requires at least 1 flow part in an automation flow.

Not ideal, but hopefully acceptable.

To compensate for a timezone difference i needed to change the “Z” into “.52+02:00”

Hi @roland.beernink, just a final quick note. This may lead to problems when switching from summer to winter time and vice-versa. Triggre handles all of these nitty-gritty details for you normally, if the time zone is provided.