Can report template use conditional statement?

(5 posts) (2 voices)


No tags yet.

  1. jasmondluk, Member

    I want to include below line only if #onlinepayment_fee is not equal to zero. Is it possible?

    <tr class="item">
    <td pre-line>
    Online payment charge {#SMS fee period}


  2. myDBR Team, Key Master

    You can hide the line when the #onlinepayment_fee equals zero by adding add a class using a template variable. You could also use a different template based on the condition, but the hiding would be easier to maintain.

    myDBR Team

  3. jasmondluk, Member

    Is it possible to give me the sample code? Thanks a lot

  4. myDBR Team, Key Master

    You can do:

    <tr class="item" style="{#hide_paymentfee}">
    <td>Online payment charge {#SMS fee period}</td>

    And in your report:

    select paymentfee as 'onlinepayment_fee', if(paymentfee=0, 'display:none','') as 'hide_paymentfee'
    from ...

    myDBR Team

  5. jasmondluk, Member

    Thank you so much


You must log in to post.