Question

I want to write and if condition with or conditions :

[% IF  bug.product == 'CustomerCare' or bug.product =='Alerts' or bug.product =='Chatlog' %]
<tr><td colspan="2">   <h3 align="center">Have you verified the Checklist ?</h3></td></tr>

<tr> 
    <td>  
        <input type="checkbox" id="chck1" name="greet" value="1" [% FOREACH gre =  chk_greet%] checked [% END%] /> 
    </td>

    <td> 
        <label for = "chck1">  Greet the customer ?</label> 
    </td>
</tr>

<tr>
    <td> <input type="checkbox" id="chck2" name="issue_status" value="1" [% FOREACH iss =  chk_issustat%] checked [% END%] /> 
    </td>
    <td> <label for = "chck2">Issue under concern and its status (whether resolved or not)</label> </td> 
</tr>

<tr> 
    <td> 
        <input type="checkbox" id="chck3" name="done_fix" value="1" [% FOREACH don = chk_done%] checked [% END%] [% END %]/> 
    </td> 
</tr> 

What is the correct format to write this condition?

Was it helpful?

Solution 2

If your lists of values starts to get a bit big, using a hashref is another way to simplify this logic - particularly if you are going to end up writing it over and over and over. It also makes the logic clearer and less verbose.

[%- # Do this once, near the top.
    SET checklistable = { CustomerCare => 1, Alerts => 1, Chatlog => 1 }; -%]

[%- # then later on, as required;
    IF checklistable.item(bug.product);
        ....
    END; -%]

OTHER TIPS

Read the fine manual. It includes examples for your very case.

[% IF (bug.product == 'CustomerCare') || (bug.product =='Alerts') ... %]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top