• Resolved sajtfokus

    (@sajtfokus)


    Hi,

    Is there a way to incorporate OR logic into this:

    <%fieldname1_block if_value_like={{apple}}%> OR <%fieldname2_block if_value_like={{orange}}%>

    some text

    <%fieldname1_endblock%>
    <%fieldname2_endblock%>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @sajtfokus

    Thank you very much for using our plugin.

    If you embed block/endblock tags you would be implementing an “and” operator:


    <%fieldname1_block if_value_like={{apple}}%>
    <%fieldname2_block if_value_like={{orange}}%>
    some text
    <%fieldname2_endblock%>
    <%fieldname1_endblock%>

    There are two possible solutions to implement an “or”:

    • You can insert a calculated field in the form to be used as an auxiliary (you can hide it by ticking a checkbox in its settings), and enter the equation:
    IF(OR(fieldname1 == 'apple', fieldname2 == 'orange'), 1, 0)

    And use the block tags:


    <%fieldname3_block if_value_is={{1}}%>
    some text
    <%fieldname3_endblock%>
    • The second alternative requires to duplicate blocks:

    <%fieldname1_block if_value_like={{apple}}%>
    some text
    <%fieldname1_endblock%>
    <%fieldname1_block if_value_unlike={{apple}}%>
    <%fieldname2_block if_value_like={{orange}}%>
    some text
    <%fieldname2_endblock%>
    <%fieldname1_endblock%>

    The previous structure prevents repeating the “some text” text.

    Best regards.

    Thread Starter sajtfokus

    (@sajtfokus)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘OR statement’ is closed to new replies.