Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I have the following if statement (which works fine ) :
If (Status like 'Approved*' ,'qmem://<bundled>/BuiltIn/led_g.png', // If Status 'approved' then green led
If (Status like 'Pending*','qmem://<bundled>/BuiltIn/led_r.png', // If Status 'pending' then red led
'qmem://<bundled>/BuiltIn/led_y.png')) as Invoice_Status // otherwise yellow led
However If add an ADD statement using a field in the same table it seems I am missing brackets somewhere and my syntax is incorrect (?)
If (Status like 'Approved*' AND Invoice like 'Paid*','qmem://<bundled>/BuiltIn/led_g.png', // If Status 'approved' AND invoice 'paid' then green led
If (Status like 'Pending*','qmem://<bundled>/BuiltIn/led_r.png', // If Status 'pending' then red led
'qmem://<bundled>/BuiltIn/led_y.png')) as Invoice_Status // otherwise yellow led
Can anyone assist in spotting the mistake(s) in my syntax ?
Thanks
Make sure you're using exact case sensitive values. Invoice is not the same field as invoice. And 'Paid' is not 'paid'.
Hi Gysbert, I've checked that and they are the exact same values. As mentioned the first statement works but as soon as I add an 'and' statement it highlights the brackets as if to say there is a bracket missing elsewhere.
Can you please close your earlier discussion If statement format?
BTW how do you know that this code is wrong? Does the script engine complain? Do you get NULL values? Does the code always return the default value (last parameter)?
I don't know the order of precedence of logical operators by heart, but you can try adding more parentheses to separate the components of the logical expression, like in:
If ((Status like 'Approved*') AND (Invoice like 'Paid*'), 'qmem://<bundled>/BuiltIn/led_g.png',