In order to group same data and sum the values in single row can be done in below mentioned way.
lets assume we have xml data as follows
<DATA_DS>
<PRODUCT_SALES>
<PRODUCT>Keyboards</PRODUCT>
<SALES>123</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Mother Boards</PRODUCT>
<SALES>23</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Keyboards</PRODUCT>
<SALES>230</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Mother Boards</PRODUCT>
<SALES>13</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Mother Boards</PRODUCT>
<SALES>33</SALES>
</PRODUCT_SALES>
</DATA_DS>
Normal table output looks like below
If we want see data as below
create a rtf template
Codes for each form field used in above table are
F <?for-each-group:DATA_DS/PRODUCT_SALES;PRODUCT?>
PRODUCT <?PRODUCT?>
SALES <?sum(current-group()//SALES)?>
E <?end for-each?>
lets assume we have xml data as follows
<DATA_DS>
<PRODUCT_SALES>
<PRODUCT>Keyboards</PRODUCT>
<SALES>123</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Mother Boards</PRODUCT>
<SALES>23</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Keyboards</PRODUCT>
<SALES>230</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Mother Boards</PRODUCT>
<SALES>13</SALES>
</PRODUCT_SALES>
<PRODUCT_SALES>
<PRODUCT>Mother Boards</PRODUCT>
<SALES>33</SALES>
</PRODUCT_SALES>
</DATA_DS>
Normal table output looks like below
If we want see data as below
create a rtf template
Codes for each form field used in above table are
F <?for-each-group:DATA_DS/PRODUCT_SALES;PRODUCT?>
PRODUCT <?PRODUCT?>
SALES <?sum(current-group()//SALES)?>
E <?end for-each?>
No comments:
Post a Comment