Search This Blog

Tuesday 5 February 2013

Running Totals


                                               Running Totals

Here we are using same RTF which we had used in IF CONDITION which is shown below.
Here we are going to calculate Running total.
Now we can see step by step process.
Our basic RTF looks


This example uses the following XML:


To create the Running Total field, define a variable to track the total and initialize it to 0.
First we have to declare or set a variable for that we have to take one field and in that field we are going to set a variable which should take before starting of main group i.e. Vendor Name as shown below.




Now add one more column to the RTF for displaying running totals as shown below.
Place the cursor in Inv_Amt column Right click to create one more column.
Click ok.
Do the same step to create one more cell .
Give the name of the column and take one form field which is shown below
Give double click on the field and Provide proper default text and in Add Help Text and in that we are going to write below command.
<?xdoxslt:set_variable($_XDOCTX,'RUNTOT',xdoxslt:get_variable($_XDOCTX,'RUNTOT')+UNIT_PRICE)?>
<?xdoxslt:get_variable($_XDOCTX,'RUNTOT')?>

Click ok.
Now our RTF looks

Now we have to publish the report

Click on Template Builder => Preview => HTML/PDF/Excel/RTF (any format).
We can get below output



From the above output we can say that Inv Amt is adding one by one where we can say it in Run total











No comments:

Post a Comment