01-17-2024 03:24 AM
Lets say i have a string:"FF;0545454;value1;test;01;99;;;value2;866"
how can i tell snaplogic in mapper, if third value is (value1) and value in fifth column is 01, change second value to 888 so the result will be:
"FF;888;value1;test;01;99;;;value2;866"
i tried something in mapper:
$myString.split(';')[2] == 'value1' && $myString.split(';')[4] == '01' ?
but i dont know how to finish it
Thank you
Solved! Go to Solution.
01-17-2024 03:32 AM
Hello @SL12345.
You can try with the following expression in a Mapper Snap:
$myString.split(';')[2]=='value1' && $myString.split(';')[4]=='01' ? $myString.split(';').map((x,ind) => ind == 1 ? 888 : x).join(';') : $myString
Let me know if this helps you.
Regards,
Aleksandar.
01-17-2024 03:32 AM
Hello @SL12345.
You can try with the following expression in a Mapper Snap:
$myString.split(';')[2]=='value1' && $myString.split(';')[4]=='01' ? $myString.split(';').map((x,ind) => ind == 1 ? 888 : x).join(';') : $myString
Let me know if this helps you.
Regards,
Aleksandar.
01-17-2024 05:47 AM
thank you, it works 🙂