Skip to main content
July 28, 2023
Question

how to check two local variables equal or not ?

  • July 28, 2023
  • 4 replies
  • 0 views

how tow write the if condition to check the two local variables are equal or not ?

    4 replies

    harshm4411
    July 28, 2023

    For verifying the equality of two local variables. One such method is:

    a!localVariables(
    local!var1:10,
    local!var2:20,
    if(local!var1=local!var2,true,false)
    )

    stewart.burchell
    November 7, 2023

    You do not need the if() statement here. It's unnecessarily verbose. You can just write it like this:

    a!localVariables(
    local!var1:10,
    local!var2:20,
    local!var1=local!var2
    )

    November 7, 2023

    a!localVariables(
      local!variable1:3,
      local!variable2:3,
      if(
        local!variable1 = local!variable2,
        /* True condition - Variables are equal */
        "Variables are equal",
        /* False condition - Variables are not equal */
        "Variables are not equal"
      )
    )


    we use the if function to compare local!variable1 and local!variable2. If the two variables are equal, the true condition is executed, which in this case displays the message "Variables are equal." If the variables are not equal, the false condition is executed, displaying a different message.

    You can modify the actions in the true and false conditions according to your requirements. The key part is the comparison, which is done with the = operator.

    stefanhelzle0001
    November 7, 2023

    I highly recommend the public Appian documentation. Specifically this part: https://docs.appian.com/suite/help/23.3/parts-of-an-expression.html