7 Replies Latest reply on Jun 15, 2016 10:21 AM by 5d96dcb42eff14c69388c3ddbf7e6636cff71ef9

    IF and Else if statement


      Using velocity script and custom object I'm trying to script an IF and Else if statement with multiple conditions using (&&) and (!=). Here is a sample of the code.


      I'm getting the content to render correctly for when it meets one of the condition (when variable.variableName == A OR == B) but I can't get it to render right for when variable.variableName equals to both A AND B. So pretty much the last condition is not working and I can't get it to show both A and B contents. Any ideas? Thanks!



                     #foreach($variable in $variable_cList)
                     #if(${variable.variableName} == "A" && ${variable.variableName} != "B")
                     #set($matched = ${variable.variableID})
                     Show content A


                     #elseif(${variable.variableName} != "A" && ${variable.variableName} == "B")
                     #set($matched = ${variable.variableID})
                     Show content B
                     #elseif(${variable.variableName} == "A" && ${variable.variableName} == "B")
                     #set($matched = ${variable.variableID})
                     Show A and B contents