Implemented

Add nested 'if' statement into expressions in LW.net

Can you please add a nested 'if' statement into the expressions in LW.net imports/exports? Currently, the 'if' functionality works if there are only 2 'if' clauses:



iif[c, a, b] - where 'c' is the condition and must evaluate to a Boolean. The value 'a' is returned if 'c' is true, otherwise, the value 'b' is returned.



However, if we have more than 2 conditions, we are not able to use this function. We tried to nest an 'if' condition into 'b' but LW.net can't evaluate it since it's surrounded with double quotes and count it as a string.

1 person likes this idea
It can already be done. You have to use variables to achieve this.

Example:

a:=iif[v{RetailPrice}>1, True, False];
b:=iif[v{RetailPrice}>2, True, False];
iif[a=true AND b=true, True, False]

you need to nest and look back on itself


so if you condition the subsource to be four different values based off a number do as below:


sub1:="Subsource 1";
sub2:="Subsource 1";
sub3:="Subsource 1";
subsource:= iif[v{ImportField}=703025,sub1,v{ImportField}];
subsource:= iif[subsource=703572,sub2,subsource];
subsource:= iif[subsource=703725,sub3,subsource];
iif[subsource =v{ImportField},sub4,subsource]


Login to post a comment