How to put conditions in the "translationMap" data action response

For example, if the response data is one of the following,
{
"result": [
{
"u_location_sys_id": "xxxxx",.
"employee_number": "aaaaa"
}
]
}
In the translationMap, the following statement is made.
"translationMap": {
"u_location_sys_id":"$.result[0]. ["u_location.sys_id"]", }
"employee_number": "$.result[0].employee_number"
}

What we want to achieve is if more than one data is returned as follows,
If multiple data are returned as shown below, "u_location_sys_id" should be a fixed value (e.g., "duplication").
We want to store a fixed value for "u_location_sys_id".
I don't know how to describe the "translationMap" condition, so please tell me.

{
"result": [
{
"u_location_sys_id": "xxxxx", "employee_number": "aaaaa
"employee_number": "aaaaa"
},
{
"u_location_sys_id": "yyyyy", "employee_number".
"employee_number": "bbbbb"
}
]
}

I do not know of any way to make a translation map do what you are asking for.

It is best to think of the translation map as a filter. You can use it to pull specific parts out of the response from the endpoint, but you can not add data with it.

If you returned this response to architect you could check if there was more than 1 entry in the results lists, and then take action based on that.

--Jason

I dont think you can use conditional in the TranslationMap section, but you can use conditional in the success section, using the variables defined in the translation map. I hope this help you

1 Like

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