How to set a variable in rtf Template | xdoxslt:set_variable

image 1 set a variable in rtf Template 1

In Bi Publisher , this is a very common requirement to set a variable in RTF template to do some data manipulation activities.

Set variable is used to declare the variable in the BI publisher reports. We need to declare the variable first and then initialize with some value. Set variable helps to Declare and initialize the value to the variable in the XML/BI publisher report.

Some examples are to set a Running Total in BIP , Count Records in a Group etc.

Steps to add a variable in RTF

  • From the bi publiser menu in word insert the form field in RTF and add below code in the form field.
  • Make sure Variable form field is outside the grouping loop.
  • Add the below codes for each of the variables in its form field help text.
<?xdoxslt:set_variable($_XDOCTX, 'counter', 0)?>
<?xdoxslt:set_variable($_XDOCTX, 'lines_page', 4)?>
<?xdoxslt:set_variable($_XDOCTX, 'tot_lines', count(.//G_SLNO))?>
<?xdoxslt:set_variable($_XDOCTX,'remainder',0)?>

The above code will create variables counter, lines_page, tot_lines, remainder

G_SLNO is the example group name.

  • Call the below code in form field before end the loop (Inside the loop)
xslt:get_variable($_XDOCTX, ‘lines_page’) <= 0?><?call:breaking?><?end if?><?end if?>

Running Total Variable in BIP

  • For taking Running total, use below code.
  • Make sure Variable outside the loop.
  • Add the code in the form field.
<?xdoxslt:set_variable($_XDOCTX, ‘counter’, 0)?>

  • call the below code in form field before end the loop (Inside the loop)
xslt:get_variable($_XDOCTX, counter + <ColumnName>) <?end if?>

Column name is the field you want to have a running total.

We will be happy to hear your thoughts

      Leave a reply

      Cloud Technologies Blog
      Logo
      Compare items
      • Total (0)
      Compare
      0
      Ads Blocker Image Powered by Code Help Pro

      Ads Blocker Detected!!!

      We have detected that you are using extensions to block ads. This website runs on Ad revenue to manage the server hosting costs. Please help us by removing the ad blocker extension from your browser or use another browser that does not have Blockers. 

      Optionally if you have the option to whitelist https://wpsbutton.com in your blocker extension, please do.

      Thankyou

      Shopping cart