Friday, September 4, 2020

Group Left with Grand Totals and Subtotals in RTF

 Process:

1.     Creating RTF Template with Group Left Option

2.     Adding Sub Totals

3.     Adding Grand Totals

4.     Verifying the Results

 

Purpose: Default Group By Option gives the output in the below format

Expected Output with Group Left Option

Step 1: Creating RTF Template with Group Left Option

While selecting Group By Option select Group Left as shown below

Group Left groups the group by element occurrences together

If you run the Template at this stage it will give the below result

Step 2: Adding Sub Totals

To add the sub Totals we need to use the Variables Concept in RTF

1.     Initializing the Variable:

<?xdoxslt:set_variable($_XDOCTX, 'Variable Name’, 0)?>

2.     Setting Up the Variable:

<?xdoxslt:set_variable($_XDOCTX, 'Variable Name’, xdoxslt:get_variable($_XDOCTX, 'Variable Name’)+Column_to_be_summed)?>

3.     Getting the Variable:

<?xdoxslt:get_variable($_XDOCTX, 'Variable Name’)?>

4.     Re-setting the Variable:

<?xdoxslt:set_variable($_XDOCTX, 'Variable Name’, 0)?>

Arrange them as shown below

If you run the Template at this stage it will give the below result

Step 3: Adding Grand Totals

Add this Tag <?sum(Column_to_be_summed)?> as shown below

Step 4: Verifying the Results

Final Result after adding sub Total and Grand Totals with group left option is shown below

No comments:

Post a Comment