Page 1 of 1
How does the IIF function work?
Posted: Wed Dec 15, 2010 3:50 pm
by esfisher
I'm evaluating your software for use with our flex-based software. I'm trying to create a report that lists individuals and their phone numbers. Some individuals do not have phone numbers, so I want to check for 'null' values and output an empty string if that is the case.
If I do nothing, using {registrant_data.phone_number}, then the report outputs 'null' in the phone column for those individuals without phone numbers and the correct phone number for those who do have phone numbers.
If I use the expression
Code: Select all
{(registrant_data.phone_number == null) ? '' : registrant_data.phone_number}
or
Code: Select all
{IFF((registrant_data.phone_number == null),'',registrant_data.phone_number)}
then I get nothing in the output, even for those registrants with phone numbers.
I also have another situation where I need to check registrants against a guardian name. If they are the same, meaning they have no guardian, then it should display nothing. If they are different, meaning they have a guardian, it should display the guardian name. However, the following expression does not work:
Code: Select all
{IFF((registrant_data.primary_name == registrant_data.participant_name),'',registrant_data.primary_name)}
My question is, what do I need to do to get the IIF function to compare and output the correct values?
Also, I am sending the report data via XML
How does the IIF function work?
Posted: Thu Dec 16, 2010 12:39 am
by Ivan
Hello,
Please try to use the following expressions:
Code: Select all
{(registrant_data.phone_number == null) ? "" : registrant_data.phone_number}
{IIF((registrant_data.phone_number == null),"",registrant_data.phone_number)}
{IIF((registrant_data.primary_name == registrant_data.participant_name),"",registrant_data.primary_name)}
Thank you.
How does the IIF function work?
Posted: Mon Dec 20, 2010 1:51 pm
by esfisher
Thank you. That fixed it.
How does the IIF function work?
Posted: Wed Dec 22, 2010 6:27 am
by Andrew
Ok!
Have a great day!
Thank you.
How does the IIF function work?
Posted: Thu Dec 08, 2011 10:28 am
by PRabbat
Hello,
I am having a similar issue, however, I am attempting to evaluate a boolean instead of a string.
Using the previous example, let's say I have a boolean labeled registrant_data.has_phone_number. First, I need to check if the expression is null. If it's not null, I need to check the value of the has_phone_number boolean. If it is true, I want to display the text "Has Phone Number" in a grid. If the value is false, I want to display "Does Not Have Phone Number".
The expression:
Code: Select all
{(registrant_data.has_phone_number == null) ? "" : registrant_data.has_phone_number}
{IIF((registrant_data.has_phone_number == null),"",registrant_data.has_phone_number)}
{IIF((registrant_data.has_phone_number),"Has Phone Number", "Does Not Have Phone Number")}
Does not work because the IFF expects a string instead of a boolean. Is there a way around this?
Thanks,
Paul
How does the IIF function work?
Posted: Fri Dec 09, 2011 2:41 am
by HighAley
Hello, Paul.
PRabbat wrote:I am having a similar issue, however, I am attempting to evaluate a boolean instead of a string.
Using the previous example, let's say I have a boolean labeled registrant_data.has_phone_number. First, I need to check if the expression is null. If it's not null, I need to check the value of the has_phone_number boolean. If it is true, I want to display the text "Has Phone Number" in a grid. If the value is false, I want to display "Does Not Have Phone Number".
The expression:
Code: Select all
{(registrant_data.has_phone_number == null) ? "" : registrant_data.has_phone_number}
{IIF((registrant_data.has_phone_number == null),"",registrant_data.has_phone_number)}
{IIF((registrant_data.has_phone_number),"Has Phone Number", "Does Not Have Phone Number")}
Does not work because the IFF expects a string instead of a boolean. Is there a way around this?
Which expression of three ones do you use?
Thank you.
How does the IIF function work?
Posted: Mon Dec 12, 2011 8:06 am
by PRabbat
I am using the expression:
Code: Select all
{IIF(((registrant_data.has_phone_number == null) || !(registrant_data.has_phone_number) ),"","The User Has a Phone Number")}
As stated before, has_phone_number is a boolean.
How does the IIF function work?
Posted: Wed Dec 14, 2011 5:30 am
by Alex K.
Hello,
We check this expression and it is work correctly.
Can you please send us your report with test data for analysis.
Thank you.
Re: How does the IIF function work?
Posted: Mon Dec 02, 2013 12:43 pm
by smith512
Hiii
can any one help me out how to use multiple if else condition using IIF with example
im using this expression {(registrant_data.has_phone_number == null) ? "" : registrant_data.has_phone_number}
and i want to execute if elseif else
im getting syntax error or the output is blank.
thanks in advance
Re: How does the IIF function work?
Posted: Thu Dec 05, 2013 7:10 am
by HighAley
Hello.
Please, try to remove Braces {} from your expression.
Thank you.