Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The ‘Iff’ formula is used to evaluate a certain condition and then further evaluates a formula based on how the condition is evaluated. Parameters include:

The “Iff” formula is used to evaluate a condition

...

The logic to evaluate if the condition is true

...

as TRUE/FALSE. Based on that evaluation, a value is assigned to the Calculated Field. Parameters include:

Code Block
Iff({Condition to check},"Value if TRUE","Value if FALSE")
Parameter 1. {Condition to check}
Parameter 2. "Value if TRUE"
Parameter 3. "Value if FALSE"
  1. Condition to check - a boolean equation that should result in a value of TRUE or FALSE

  2. Value if TRUE - the value the Calculated Field Question will be if the Condition to check is TRUE

  3. Value if FALSE - the value the Calculated Field Question will be if the Condition to check is FALSE

Examples

  • Iff((14 - 7) > 0, DateDiff('today', ‘yesterday', ‘h'), 50 / 2)

    • The above formula will evaluate if the condition “14 “Condition to check” is “(14 - 7) > 0” is true or falseIf true, it will evaluate

    • The “Value if TRUE” is “DateDiff(’today’, ‘yesterday’, 'h')If false, it will evaluate ” which is 24

    • The “Value if FALSE” is “50 / 2” which is 25

    • Since (14 - 7) > 0 is TRUE, the value assigned to the Calculated Field Question will be 24

  • Iff(ResponseExists([RadioQ1] )> 0, [RadioQ1] < 13, false)

  • The above formula will evaluate the condition “ResponseExists([RadioQ1])”

  • If true, “[RadioQ1] < 1” will be evaluated

  • If false, “false” will be evaluated

    FALSE)

    • The Condition to check is “[RadioQ1] > 0”

    • The Value if TRUE is “[RadioQ1] < 3” which will be TRUE/FALSE depending on the value of [RadioQ1]

    • The Value if FALSE is “FALSE”

    • The table below will show what the Calculated Field Question value will be based on the value of [RadioQ1]

[RadioQ1] Value

Calculated Field Question Value

Reasoning

0

FALSE

Since [RadioQ1] = 0, then the “Condition to check” equates to FALSE since 0 is not greater than 0. Since it is FALSE, the “Value if FALSE” will be assigned to the Calculated Field Question, which is FALSE.

1

TRUE

The “Condition to check” will equate to TRUE since 1 is greater than 0. Since it is TRUE, the “Value if TRUE” will be assigned to the Calculated Field Question.

Since [RadioQ1] = 1, then the “Value if TRUE” will equal TRUE since 1 is less than 3. Therefore, the Calculated Field Question will be assigned a value of TRUE.

2

TRUE

The “Condition to check” will equate to TRUE since 2 is greater than 0. Since it is TRUE, the “Value if TRUE” will be assigned to the Calculated Field Question.

Since [RadioQ1] = 2, then the “Value if TRUE” will equal TRUE since 2 is less than 3. Therefore, the Calculated Field Question will be assigned a value of TRUE.

3

FALSE

The “Condition to check” will equate to TRUE since 3 is greater than 0. Since it is TRUE, the “Value if TRUE” will be assigned to the Calculated Field Question.

Since [RadioQ1] = 3, then the “Value if TRUE” will equal FALSE since 3 is NOT less than 3. Therefore, the Calculated Field Question will be assigned a value of FALSE.

  • Iff(Contains([QuestionOne], 2), 1, 0)

    • The above 'Iff' formula will evaluate if the condition “Contains([QuestionOne], 2)” is true or false

    • The 'Contains' formula will get the last response for the question “QuestionOne” and check if ‘2' was one of them. If ‘2’ was one of them the logic will return TRUE and if '2’ was not one of them the logic will return FALSE.

    • If true, it will evaluate “1”

    • If false, it will evaluate “0”

...