Tuesday 24 December 2013

Running column Totals in XML Publisher

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

4 comments:

  1. HI,

    I am getting an error: Caused by: oracle.xdo.parser.v2.xpathexception: cannot convert to number. etc etc....

    First I thought it is due to a null value so, I corrected it and verified from the XML output that all null values are taken care of. Having done this still the error persists. I am calculating running total just like showed only difference is I am doing set and get in one statement and then display it at other location using get.


    I have 3 4 similar variables doing almost the same job. When I take out all these variable and run the concurrent program the output report is generated successfully.

    Also, using the xml data output the report is able to run locally; the problem occurs when run thru concurrent program.

    ReplyDelete
  2. Hello Shrikant..i am facing same issue.could you please provide a solution ?

    ReplyDelete
  3. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. running track resurfacing, athletics track flooring

    ReplyDelete
  4. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. 増田裕介

    ReplyDelete