โ03-16-2022 10:29 AM
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โ
}
]
โ03-18-2022 06:07 AM
Hi @Cele Thank you so much for the kind and detailed explanation, Really much helpful.
Thanks again for the support.
Regards,
Parthiban S