fantaghirocco
fantaghirocco

Reputation: 4878

Inserting parameters into a template loop

Is it possible to use the parameters declared in the parameters' node (see the XDT file) inside a foreach loop in the template? I'd have to add a namespace? If yes which one?

File XDT:

<dataTemplate name="StoreLayoutLabels" xmlns="http://micros.com/xstore/config/report">
  <labels>
    <!-- Template-specific Text -->
    <label name="HANDHELD_READ" value="_art.inventory.handheld.read"/>
    <label name="MANUAL_CHECK" value="_art.inventory.manual.check"/>
    <label name="OPERATOR1" value="_art.inventory.operator1"/>
    <label name="OPERATOR2" value="_art.inventory.operator2"/>
    <label name="SECTION" value="_art.inventory.section"/>
    <label name="STORE" value="_art.inventory.store"/>
  </labels>
 
  <parameters>
    <!-- System Parameters -->
    <parameter name="GroupName" class="java.lang.String" isForPrompting="false" include_in_output="true"/>
    <parameter name="storeNbr" class="java.lang.String" isForPrompting="false" include_in_output="true"/>
    <parameter name="storeName" class="java.lang.String" isForPrompting="false" include_in_output="true"/>
  </parameters>
    
  <!--Data source and data Structure-->
  <dataSource>
    <dataReference name="Q_STORE_LAYOUT_LABELS"> 
      <ResultFields>
          <ResultField>SectionId</ResultField>
          <ResultField>SectionDescription</ResultField>
      </ResultFields>
    </dataReference>
  </dataSource>
  <dataStructure>
    <group name="STORE_LAYOUT_LABELS" source="Q_STORE_LAYOUT_LABELS">
      <element name="SECTION_ID" value="SectionId"/>
      <element name="SECTION_DESCRIPTION" value="SectionDescription"/>
    </group>
  </dataStructure>
</dataTemplate>

Report template:

enter image description here

For example, PAR_GROUP_NAME is represented by the <?GroupName?> tag in the template but it doesn't appear after the PDF transformation. The value is shown correctly if the tag is inserted outside the label F which represents the loop.

Upvotes: 0

Views: 895

Answers (1)

EdHayes3
EdHayes3

Reputation: 1953

When you reference a field, it's looking inside the element you are currently in. So you will need to tell BI Publisher where it is if it's not in the current element. Just add ../ for each level you need to go up the tree, and then once you get into the first common element, you can then go back down.

So if you are in a <?for-each:dataSource?> You can get the parameter attribute value, where the attribute name = GroupName, by doing:

<?../parameters/parameter[@name='GroupName']?>

Reference: https://docs.oracle.com/cd/E80149_01/bip/BIPRD/GUID-4D9FC5FC-5A72-4CE6-919C-A3E0D6E4900C.htm#BIPRD2597

Upvotes: 1

Related Questions