cancel
Showing results for 
Search instead for 
Did you mean: 

To replace more than one character in string by looking up another field value

RaymanPrince
New Contributor II

I have a business requirement, where we have below JSON in that, have to update object’s field called TRANSLATION_ID by looking up another fields called VARIABLE_ID and VARIABLE_VALUE. Here if both VARIABLE_ID and VARIABLE_VALUE are not null then replace TRANSLATION_ID (say [A] to be replaceed with value in the variable value) with corresponding values present in VARIABLE_VALUE.

Note: Here currently we have max of 2 replacement values in VARIABLE_VALUE but we expect it can be more than 10.

Input json :
[
{
“PHRASE_SEQ”: 629,
“PHRASE_ID”: “[Drug Name]”,
“PLACEMENT”: “12”,
“TRANSLATION_ID”: “[Drug Name]”,
“VARIABLE_ID”: “Drug Name”,
“VARIABLE_VALUE”: “str456”
},
{
“PHRASE_SEQ”: 630,
“PHRASE_ID”: “Store at [A]°C to [B]°C”,
“PLACEMENT”: “13”,
“TRANSLATION_ID”: “Store at [A]°C to [B]°C”,
“VARIABLE_ID”: “A,B”,
“VARIABLE_VALUE”: “2,8”
}
]

Expected output would be:
[
{
“PHRASE_SEQ”: 629,
“PHRASE_ID”: “[Drug Name]”,
“PLACEMENT”: “12”,
“TRANSLATION_ID”: “str456”,
“VARIABLE_ID”: “Drug Name”,
“VARIABLE_VALUE”: “str456”
},
{
“PHRASE_SEQ”: 630,
“PHRASE_ID”: “Store at [A]°C to [B]°C”,
“PLACEMENT”: “13”,
“TRANSLATION_ID”: “Store at 2°C to 8°C”,
“VARIABLE_ID”: “A,B”,
“VARIABLE_VALUE”: “2,8”
}
]

5 REPLIES 5

parthiban_jks
New Contributor II

Hi @Cele Thank you so much for the kind and detailed explanation, Really much helpful.

Thanks again for the support.

Regards,
Parthiban S