โ04-08-2024 06:14 AM
Hi,
I have 3 variables - Receiver, ISA07, ISA08
I will have to update ISA07 and ISA08 variables based on the value of Receiver.
if Receiver has value as 12+0975677. I need to validate whether receiver variable has "+" value. If so I will update ISA07=12 and ISA08=0975677. How to achieve it in formula mode.
Thanks
Solved! Go to Solution.
โ04-08-2024 07:33 PM
Try this:
For ISA07:
Receiver.include?("+") ? "12" : ISA07
For ISA08:
Receiver.include?("+") ? "0975677" : ISA08
If Receiver does not include "+" the variables will remain the same.
โ04-09-2024 03:31 AM
Hi @MurugarajSa ,
You can use below formulae for the match
ISA07:
Receiver.match?(/[\/+]/)? "12" : "ISA07"
ISA08:
Receiver.match?(/[\/+]/)? "0975677" : "ISA08"
โ04-09-2024 09:35 AM
Will the Receiver value ALWAYS be "12+0975677" ? Or can the "12" and the "0975677" change?
For example, if you received "99+7777777", you would expect ISA07 = "99" and ISA08 = "7777777" ?
If this is the case, then you need to do this a bit differently:
ISA07:
receiver.match?(/[\/+]/) ? receiver.split(/[\/+]/)[0] : isa07
ISA08:
receiver.match?(/[\/+]/) ? receiver.split(/[\/+]/)[1] : isa08
Credit to @shivakumara for the regex
โ04-08-2024 07:33 PM
Try this:
For ISA07:
Receiver.include?("+") ? "12" : ISA07
For ISA08:
Receiver.include?("+") ? "0975677" : ISA08
If Receiver does not include "+" the variables will remain the same.
โ04-09-2024 03:04 AM
Hi @gary1
It worked perfectly. But
One concern is Receiver variable might have value "+" or "/". (E.g. 12+0975677, 12/0975677).
ISA07 should be 12 and ISA08 should be 0975677.
Can you please suggest me how I can achieve this?
Thanks in advance.
โ04-09-2024 03:31 AM
Hi @MurugarajSa ,
You can use below formulae for the match
ISA07:
Receiver.match?(/[\/+]/)? "12" : "ISA07"
ISA08:
Receiver.match?(/[\/+]/)? "0975677" : "ISA08"
โ04-09-2024 11:04 AM
Hi @shivakumara
Thanks