Bi Publisher – Using variables in rtf

If you have to use variables in rtf to do some calculations like adding two number etc, this is how you go about doing so.

The following e.g. shows how to add 1 to any value

Initialize a variable to 0 where A is the name of the variable :

<?xdoxslt:set_variable($_XDOCTX, ‘A’, 0)?>

add 1 to A :

<?xdoxslt:set_variable($_XDOCTX,’A’,xdoxslt:get_variable($_XDOCTX,’A’)+1)?>

Display the value A:

<?xdoxslt:get_variable($_XDOCTX,’A’)?>

Adding two column values in rtf

Initialize variable A:

<?xdoxslt:set_variable($_XDOCTX, ‘A’, 0.00)?>

Initialize variable B :

<?xdoxslt:set_variable($_XDOCTX, ‘B’, 0.00)?>

Initialize variable A with column1 value:

<?xdoxslt:set_variable($_XDOCTX, ‘A’,xdoxslt:get_variable($_XDOCTX, ‘A’)+PEEVF_SCREEN_ENT)?>

where PEEVF_SCREEN_ENT is the value of column 1

Initialize variable B with column2 value:

<?xdoxslt:set_variable($_XDOCTX, ‘B’,xdoxslt:get_variable($_XDOCTX, ‘B’)+PEEVF_SCREEN_EN1)?>

PEEVF_SCREEN_EN1  is the value of Column 2

Assign value to 3rd variable with the value of A + B

<?xdoxslt:set_variable($_XDOCTX,’C’,xdoxslt:get_variable($_XDOCTX,’A’)+xdoxslt:get_variable($_XDOCTX,’B’))?>

Display the value of variable C:

<?xdoxslt:get_variable($_XDOCTX,’C’)?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s