IIF statement

More
10 years 2 months ago #7695 by hanisultan
IIF statement was created by hanisultan
I have a field I'm populating based on a value from the query as follow

[IIF(<UniDACQuery."fa_branch"> = 1 ,'714-541-1300.','nothing')]
which works fine but

this doesn't

[IIF(<UniDACQuery."fa_branch"> in (1,2,5,7) ,'714-541-1300.','nothing')]

What am I doing wrong? Thank you

Table editor V 5.2.1.3

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #7696 by admin
Replied by admin on topic IIF statement
I think it is language limitation

[IIF(<UniDACQuery."fa_branch"> in (1,2,5,7) ,'714-541-1300.','nothing')]

Try using or

[IIF(<UniDACQuery."fa_branch"> = 1 or <UniDACQuery."fa_branch"> = 2 ,'714-541-1300.','nothing')]

John,
Support Team

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #7705 by hanisultan
Replied by hanisultan on topic IIF statement
I tried that already and it didn't work

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #7706 by admin
Replied by admin on topic IIF statement
Put it in brackets

Peter

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #7707 by hanisultan
Replied by hanisultan on topic IIF statement
I did exactly what john said

[IIF(<UniDACQuery."fa_branch"> = 1 or <UniDACQuery."fa_branch"> = 2 ,'714-541-1300.','nothing')]

but it didn't work but if I use multiple IIF like this

[IIF(<UniDACQuery."fa_branch"> = 1 ,'714-541-1300.',iif( <UniDACQuery."fa_branch"> = 2,'714-541-1300.', 'nothing'))]

But this would create a huge code, imagine if I have 10 values.

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #7711 by admin
Replied by admin on topic IIF statement
Not really

[IIF(((<UniDACQuery."fa_branch"> = 1) or (<UniDACQuery."fa_branch"> = 2)) ,'714-541-1300.','nothing')]

Mike
ETL Architect

Please Log in or Create an account to join the conversation.