Skip to main content

Compare Two Values

  • What is it? Sometimes in a form you need to make a decision based on an answer or on data retrieved from an external system such as Jadu Connect or Bartec. The result of the decision can then be used in branching rules to determine the form flow. This formula allows you to compare two values and return a decision.

Limitations

This logic performs only string comparison, date values cannot be compared.

Inputs

This formula takes the following inputs:

  • Value A the value of the left side of if condition
  • Operator the comparison function
  • Value B the value of the right side of if condition
  • Answer if true the return value if the condition evaluates as true
  • Answer if false the return value if the condition evaluates as false

Return values

ValueDescription
stringThe return value set in 'Answer if true' or 'Answer is falde'

Note: return values are case sensitive

Formula Logic

  1. If the operator is Less than the formula will return run

    if (Value A < Value B) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  2. If the operator is Greater than the formula will return run

    if (Value A > Value B) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  3. If the operator is Equal to the formula will return run

    if (Value A == Value B) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  4. If the operator is Not equal to the formula will return run

    if (Value A != Value B) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  5. If the operator is Less than or equal to the formula will return run

    if (Value A <= Value B) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  6. If the operator is Greater than or equal to the formula will return run

    if (Value A >= Value B) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  7. If the operator is Contains the formula will return run

    if (strpos(Value A, Value B) !== false) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  8. If the operator is Does not contain the formula will return run

    if (strpos(Value A, Value B) === false) {
    return Answer if true;
    }
    else {
    return Answer if false;
    }
  9. Otherwise the formula returns Answer if false