Monday 2 July 2018

Dynamic columns in xml publisher . Dynamic data columns in rtf template

Dynamic columns in xml publisher . Dynamic data columns in rtf template

 
In this post, We will create the XML reports which will create the columns dynamically in the Report output. When we have Requirment in which the report columns are not fixed in the report output and there are dynamic based on the report output so in this case , we need to design this dynamic column xml publisher rtf to meet this Requirment. Here below I am sharing the code refer from the Oracle Docs to create such kind of Dynamic Columns report in the XML publisher.
 
 
A template is required to display test score ranges for school exams. Logically, you want the report to be arranged as shown in the following table:
Test Score
Test Score Range 1
Test Score Range 2
Test Score Range 3
...Test Score Range n
Test Category
# students in Range 1
# students in Range 2
# students in Range 3
# of students in Range n
but you do not know how many Test Score Ranges will be reported. The number of Test Score Range columns is dynamic, depending on the data.
The following XML data describes these test scores. The number of occurrences of the element <TestScoreRange> will determine how many columns are required. In this case there are five columns: 0-20, 21-40, 41-60, 61-80, and 81-100. For each column there is an amount element (<NumOfStudents>) and a column width attribute (<TestScore width="15">).
 <?xml version="1.0" encoding="utf-8"?>
 <TestScoreTable>
  <TestScores>
    <TestCategory>Mathematics</TestCategory>
    <TestScore width ="15">
    <TestScoreRange>0-20</TestScoreRange>
    <NumofStudents>30</NumofStudents>
 </TestScore>
    <TestScore width ="20">
    <TestScoreRange>21-40</TestScoreRange>
    <NumofStudents>45</NumofStudents>
 </TestScore>
   <TestScore width ="15">
    <TestScoreRange>41-60</TestScoreRange>
    <NumofStudents>50</NumofStudents>
 </TestScore>
    <TestScore width ="20">
    <TestScoreRange>61-80</TestScoreRange>
    <NumofStudents>102</NumofStudents>
 </TestScore>
    <TestScore width ="15">
    <TestScoreRange>81-100</TestScoreRange>
   <NumofStudents>22</NumofStudents>
 </TestScore>
 </TestScores>
  <TestScoreTable>
Using the dynamic column tags in form fields, set up the table in two columns as shown in the following figure. The first column, "Test Score" is static. The second column, "Column Header and Splitting" is the dynamic column. At runtime this column will split according to the data, and the header for each column will be appropriately populated. The Default Text entry and Form Field Help entry for each field are listed in the table following the figure.

Default Text Entry
Form Field Help Text Entry
Group:TestScores
<?for-each:TestScores?>
Test Category
<?TestCategory?>
Column Header and Splitting
<?split-column-header:TestScore?> <?split-column-width:@width?> <?TestScoreRange?>%
Content and Splitting
<?split-column-data:TestScore?> <?NumofStudents?>
end:TestScores
<?end for-each?>
  • Test Score is the boilerplate column heading.
  • Test Category is the placeholder for the<TestCategory> data element, that is, "Mathematics," which will also be the row heading.
  • The second column is the one to be split dynamically. The width you specify will be divided by the number of columns of data. In this case, there are 5 data columns.
  • The second column will contain the dynamic "range" data. The width of the column will be divided according to the split column width. Because this example does not contain the unit value tag (<?split-column-width-unit:value?>), the column will be split on a percentage basis. Wrapping of the data will occur if required.
Note: If the tag (<?split-column-width-unit:value?>) were present, then the columns would have a specific width in points. If the total column widths were wider than the allotted space on the page, then the table would break onto another page.
The "horizontal-break-table" tag could then be used to specify how many columns to repeat on the subsequent page. For example, a value of "1" would repeat the column "Test Score" on the subsequent page, with the continuation of the columns that did not fit on the first page.
The template will render the output shown in the following figure:
Dynamic columns in xml publisher . Dynamic data columns in rtf template

4 comments:

Anonymous said...

Nice blog,explanation is good,thank you for sharing your experience on Oracle Application.For more details visit our website....Please contact us for Oracle Fusion HCM Training in Ameerpet details in our Erptree Training Institute

Unknown said...

HI,
thanks for sharing your knowklegde.
I a in need to show multi data lines for the same dynamic header!
Like your example but with many lines for test category :
Mathematics
English
Physics
Biology
etc...
Any idea?

Unknown said...

https://docs.oracle.com/middleware/12212/bip/BIPRD/GUID-B9C4322A-4BBF-4D28-B8F3-435E527EE5E6.htm#BIPRD2546

Anonymous said...

must be closed =

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *