Page 1 of 1

Variables in {IIF(,,)} Statments.

Posted: Tue Dec 03, 2019 7:36 pm
by David334
Hi, I am having an issue with using variables.
I have a basic statement like this:
{IIF(column=='N',Variable=Variable+1,Variable+1)}

I feel this may be the incorrect way to use a variable because it seem the IF statement executes both sections if the statement is false.
For example, if column equals 'N', the result is a increasing variable by 1, But if "column" is not equal to 'N', the statement executes both sections of the IIF clause, first incrementing itself my one, and then adding 1 again for the displayed output.

I was hoping it would just skip over the first section, but it seem to execute both parts of IIF statement no matter what.

Re: Variables in {IIF(,,)} Statments.

Posted: Sun Dec 08, 2019 10:12 pm
by Lech Kulikowski
Hello,

Yes, IIF() function in any case, execute both statements.

In your case, you can use the following expression:
{(column == 'N' ? Variable=Variable+1 : Variable+1)}

Thank you.

Re: Variables in {IIF(,,)} Statments.

Posted: Mon Dec 09, 2019 10:01 pm
by David334
<t>Thank you, that works.</t>

Re: Variables in {IIF(,,)} Statments.

Posted: Tue Dec 10, 2019 6:59 am
by Andrew
Great!

Thank you for the info!