Display correct data in rtf template

510 Views Asked by At

Please see the below XML template which is used by a rtf template. I have added 2 comments in the XML starting with -->

<ORDER_HEADER>
  <HEADER_ROW>
    <ORIG_SYS_DOCUMENT_REF>001529872197</ORIG_SYS_DOCUMENT_REF>
    <SALESREP>
      <SALESREP_ROW/>
    </SALESREP>
    </SOLD_TO_CONTACT>
    <SHIP_TO_CONTACT>                                    --> This SHIP TO comes under ORDER HEADER
      <SHIP_TO_CONTACT_ROW>
        <PHONE_NUMBER>6042333125201</PHONE_NUMBER>
        <EMAIL_ADDRESS>[email protected]</EMAIL_ADDRESS>
      </SHIP_TO_CONTACT_ROW>
    </SHIP_TO_CONTACT>
    <ORDER_LINES>
      <ORDER_LINES_ROW>
        <ORIG_SYS_LINE_REF>001521970</ORIG_SYS_LINE_REF>
        <ITEM_NUMBER>0158ABCSD012836</ITEM_NUMBER>
        <ORDERED_QUANTITY>2</ORDERED_QUANTITY>
        <SHIP_TO_CONTACT>                                --> This SHIP TO comes under ORDER LINES which again comes under ORDER HEADER
          <SHIP_TO_CONTACT_ROW/>
        </SHIP_TO_CONTACT>
        <INVOICE_TO_CONTACT>
          <INVOICE_TO_CONTACT_ROW/>
        </INVOICE_TO_CONTACT>
        <DELIVER_TO_CONTACT>
          <DELIVER_TO_CONTACT_ROW/>
        </DELIVER_TO_CONTACT>
      </ORDER_LINES_ROW>
    </ORDER_LINES>
  </HEADER_ROW>
</ORDER_HEADER>

I am designing a template where I need to display Ship To contact details, so I created a for loop in the template as with an ending. After loading the XML when I preview it I am getting 2 rows for ship to contact as there are 2 SHIP_TO_CONTACT sections in the xml.

My question is how can I display the records of SHIP_TO_CONTACT only from ORDER HEADERS and not from ORDER LINES?

I am using EBS 12.1.3.

Thanks

1

There are 1 best solutions below

2
On BEST ANSWER

You need to add a ./ to the for-each object. that will force BI Publisher to stay at that level.

<?for-each:ORDER_HEADER/HEADER_ROW?>
<?ORIG_SYS_DOCUMENT_REF?>
<?for-each:./SHIP_TO_CONTACT/SHIP_TO_CONTACT_ROW?>
<?PHONE_NUMBER?>
<?end for-each?>
<?end for-each?>

I tested with this XML; there appears to be several problems with the XML you provided.

<ORDER_HEADER>
  <HEADER_ROW>
    <ORIG_SYS_DOCUMENT_REF>001529872197</ORIG_SYS_DOCUMENT_REF>
    <SHIP_TO_CONTACT>                              
      <SHIP_TO_CONTACT_ROW>
        <PHONE_NUMBER>6042333125201</PHONE_NUMBER>
        <EMAIL_ADDRESS>[email protected]</EMAIL_ADDRESS>
      </SHIP_TO_CONTACT_ROW>
    </SHIP_TO_CONTACT>
    <ORDER_LINES>
      <ORDER_LINES_ROW>
        <ORIG_SYS_LINE_REF>001521970</ORIG_SYS_LINE_REF>
        <ITEM_NUMBER>0158ABCSD012836</ITEM_NUMBER>
        <ORDERED_QUANTITY>2</ORDERED_QUANTITY>
        <SHIP_TO_CONTACT>                             
          <SHIP_TO_CONTACT_ROW><PHONE_NUMBER>test</PHONE_NUMBER></SHIP_TO_CONTACT_ROW>
        </SHIP_TO_CONTACT>
      </ORDER_LINES_ROW>
    </ORDER_LINES>
  </HEADER_ROW>
</ORDER_HEADER>