Topic
  • 2 replies
  • Latest Post - ‏2013-10-15T13:03:12Z by smithha
KGHolgado
KGHolgado
1 Post

Pinned topic using IF condition statement in data rules (ELSE IF is not working)

‏2013-10-08T07:06:26Z |

Hi All,

I'm having trouble to do an IF-THEN-ELSE IFn-ELSE statement using data rules in Information Analyzer; it looks like 'ELSE IF' is not supported. Only the IF-THEN-ELSE condition statement is working.

sample expression:

IF UCASE(Gender) = 'M' THEN 'Male'
ELSE IF UCASE(Gender) = 'F' THEN 'Female'
ELSE 'Unknown'

Does anyone of you have tried to make similar expression that have nested IF statements in data rules?

-Kris

  • RobertDickson
    RobertDickson
    74 Posts

    Re: using IF condition statement in data rules (ELSE IF is not working)

    ‏2013-10-10T14:00:45Z  

    Hi Kris,

    Your sample expression is not a data rule (an expression that tests for a yes or no answer).  It looks like you are testing for M or F, and anything else is an exception.  Have you tried:

    UCASE(Gender) in_reference_list {'M','F'}

    ------

    Regards,

    Robert

    Updated on 2013-10-10T14:01:28Z at 2013-10-10T14:01:28Z by RobertDickson
  • smithha
    smithha
    162 Posts

    Re: using IF condition statement in data rules (ELSE IF is not working)

    ‏2013-10-15T13:03:12Z  

    Because of the architectural approach with Information Analyzer data rules, where the expression would require nested IF's with a SQL construct, the expression would be divided into distinct data rules that are then combined together in one Rule Set in Information Analyzer (i.e. there are no nested IF constructs).

    Example:

    Rule1:  IF UCASE(Gender) = 'M' THEN Gender2 = 'Male'
    Rule2:  IF UCASE(Gender) = 'F' THEN Gender2 = 'Female'

    Etc. And then both of these would be included in a rule set.  The advantage from this approach is that you can distinctly identify what data failed to pass each clause/condition.

    As Robert pointed out, the expressions must be boolean and result in a True/False result, so the Then clauses must contain a condition to evaluate.