My requirement to reduce the usage of nested or multiple if else conditions
I have an array of files , so i am using for each inside that using if condition
- file.contains(“Info”) then assign its full path to variable (mainPath)
In Else part:
similarly 2. file.contains(“relation”) then assign its full path to another variable (relationPath)
- file.contains(“leave”) then assign its full path to another variable (leavePath)
Thanks in advance
you can use Switch Activity for reducing the Nested IF
May be u can try this:
assume file is the variable u want to check against condition
store the keys in array variable (string)
Now use an if condition like this with condition like this
if this condition is True, then
use the following assign activity to get the corresponding key from dict_1
key= arrkeys.Where(Function(m) file.Contains(m))(0)
then once u get the corresponding key, u can get the corresponding variable value u need by dict_1(key)
Hope this help
Mark it as soln if it helps !!!
Thanks & Regards,
If ur issue is resolved , kindly mark the appropriate answer as solution
U can use one of the newer activities called “else if”:
It allows to set several conditions. Activity checks condtions from the top. If any is met as true, then body is done and else if is finishing checking the others.
Try user the switch activity.