Usually we will display the measures as the columns in a table. We can also modify this display structure in output to display these measure columns as rows by putting little in the form field codes. Assuming below xml
- <DATA_DS>
- <POPULATION>
<COUNTRY>India</COUNTRY>
<YEAR>2001</YEAR>
<MALE>60</MALE>
<FEMALE>40</FEMALE>
</POPULATION>
- <POPULATION>
<COUNTRY>Japan</COUNTRY>
<YEAR>2001</YEAR>
<MALE>50</MALE>
<FEMALE>50</FEMALE>
</POPULATION>
- <POPULATION>
<COUNTRY>India</COUNTRY>
<YEAR>2011</YEAR>
<MALE>70</MALE>
<FEMALE>30</FEMALE>
</POPULATION>
- <POPULATION>
<COUNTRY>Japan</COUNTRY>
<YEAR>2011</YEAR>
<MALE>60</MALE>
<FEMALE>40</FEMALE>
</POPULATION>
</DATA_DS>
code the form fields as
@cell (1,3) write the code as
for <?for-each-group@column:POPULATION;YEAR?>
field <?YEAR?>
end <?end for-each-group?>
@cell (2,1) write
COUNTRY <?for-each-group:POPULATION;./COUNTRY?><?variable@incontext:G1;current-group()?><?COUNTRY?>
@cell (2,3.1) write
i.e right side to Male
Males <?for-each-group@cell://POPULATION;./YEAR?><?sum ($G1[(./YEAR=current()/YEAR)]/MALE)?><?end for-each-group?>
@cell (2,3.2) write
i.e right side to Female
Females <?for-each-group@cell://POPULATION;./YEAR?><?sum ($G1[(./YEAR=current()/YEAR)]/FEMALE)?><?end for-each-group?>
No comments:
Post a Comment