Mirko_Jessulat | 2022-08-24 15:00:54 UTC | #1
Hi, we try to extract and return string data, wich was recieved by an external api request. the api returns a datetime value like "2022-08-24T16:57:25.994354+02:00". We would like to extract year, month and day like '"yyyyMMdd" as an additional response field of the data action. Is there a way within the translationMap or something else to reach this goal?
With regards
Mirko Jessulat
Jason_Mathison | 2022-08-25 17:23:54 UTC | #2
Hi Mirko,
Assuming that your endpoint returns something like this:
{"testDateTime" : "2022-08-24T16:57:25.994354+02:00"}
You can do something like this to chop out the parts that you want into yyyyMMdd:
{ "translationMap": {"testDateTime" : "testDateTime"}, "translationMapDefaults": {}, "successTemplate": "{\"yyyyMMdd\" : \"${testDateTime.substring(1, 5)}${testDateTime.substring(6, 8)}${testDateTime.substring(9, 11)}\"}" }
There are some fancier options for how to do this, but this one should be pretty easy to use and adapt to your needs.
--Jason
Mirko_Jessulat | 2022-08-25 17:24:16 UTC | #3
that works for me. thanks
system | 2022-09-25 17:24:49 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 16024