This discussion is archived
7 Replies Latest reply: Sep 20, 2013 11:24 PM by Ragul Halan RSS

Conditional Formatting in RTF template...

1011311 Newbie
Currently Being Moderated

Hi,

     I have a requirement like whenever there are no lines found for an order then the report should print a message saying "no lines found" otherwise the lines corresponding to that order number should be printed.

 

Now the problem is.How  am I supposed to build my RTF template in order to achieve above requirement?

 

 

Regards

Sandeep.G

  • 1. Re: Conditional Formatting in RTF template...
    JorgeAnicama Expert
    Currently Being Moderated

    Simply place an "if" condition in your RTF. It should be something like this:

     

    <?if:count(//myNode)=0?> No records found <?end if?>

    <?if: count()<>0?> ... your logic ...  <?end if?>

     

    Where "myNode" would be the node in which you expect to see records:

    <root>

    <myNode>

        <age>20</age>

        <name>Sue</>

    <myNode>

        <age>30</age>

        <name>Sue2</>

    <myNode>

        <age>40</age>

        <name>Sue3</>

    <myNode>

    </root>

     

    Thanks

    Jorge

    p.s If this helps you then please mark the answer as "correct" or else "helpful"

  • 2. Re: Conditional Formatting in RTF template...
    Ragul Halan Newbie
    Currently Being Moderated

    Where ever you need to print no data found, insert a if condition in front of the group.

     

    here is a example

     

    my xml structure is

        < MODULE2>

     

         - <LIST_G_EMPNO>

     

     

         - <G_EMPNO>

     

     

          <EMPNO>7839</EMPNO>

     

     

          <ENAME>ALLEN</ENAME>

     

          </G_EMPNO>

          </LIST_G_EMPNO>

    </MODULE2>


    and here is the condition i used


    F --<?for-each:LIST_G_EMPNO?>

    <?if: count(EMPNO)>0?>

    Empno

    Ename

    F EMPNO

    ENAME E

    <?end if?>

    <?if: count(EMPNO)=0?>

    ********************************NO DATA FOUND**************************************

    <?end if?>

    E -- <?end for-each?>


    when there is no data found in the xml, then you will get the string "********NO DATA FOUND ********" printed in the output.


    Thanks


    -->> If this helps you then please mark the answer as "correct" or else "helpful"



  • 3. Re: Conditional Formatting in RTF template...
    1011311 Newbie
    Currently Being Moderated

    Hi Jorge,

                   This is the XML I got where can I have a Group XML tag as in your case ??

    <XXKES_OE_ORDER_WITH_OR_WITHOUT_LINES>

     

    <LIST_G_LINE_ID></LIST_G_LINE_ID>

    </XXKES_OE_ORDER_WITH_OR_WITHOUT_LINES>

     

     

    Regards

    Sandeep.G

  • 4. Re: Conditional Formatting in RTF template...
    1011311 Newbie
    Currently Being Moderated

    Hi Ragul,

     

    This is the XML I got where can I have a Group XML tag or a child XML tag (EMPNO) as in your case ??

        

         <XXKES_OE_ORDER_WITH_OR_WITHOUT_LINES>

                   <LIST_G_LINE_ID>   </LIST_G_LINE_ID>

         </XXKES_OE_ORDER_WITH_OR_WITHOUT_LINES>

     

     

    Regards

    Sandeep.G

  • 5. Re: Conditional Formatting in RTF template...
    Ragul Halan Newbie
    Currently Being Moderated

    What if you mail me the xml and the template, i ll have a look and then give you the correct syntax

     

    my mail id is : ragul01.h@gmail.com

     

    Thanks

  • 6. Re: Conditional Formatting in RTF template...
    1011311 Newbie
    Currently Being Moderated

    Hi ragul,

                   I already commented the XML that i am getting.

    I 'll explain my requirement.

    I have a conc prog for which one parameter is attached to accept order number

    so, for any order if there are no lines then the template should print "no lines found for the order".

    and if lines are present just we need to print them.

     

     

     

    Regards

    Sandeep.G

  • 7. Re: Conditional Formatting in RTF template...
    Ragul Halan Newbie
    Currently Being Moderated

    Hi Sandeep,

     

         Just place the if condition in front of the lines group, and within the condition you can have count of any column value, when it is greater than zero then display the lines table/details , and when is it equal to zero you can have whatever you needed to print within the second if condition.

     

    in your case, within your root group and before the lines group have a condition like this (ORDER_ID will be your xml element within the lines group--you can even use any other column that comes within the lines group )

     

    F --<?for-each:XXKES_OE_ORDER_WITH_OR_WITHOUT_LINES?>

    <?if: count(ORDER_ID)>0?>

         Order details

    <?end if?>

    <?if: count(ORDER_ID)=0?>

        ********No data found*************

    <?end if?>

    E -- <?end for-each?>

     

    Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points