Showing posts with label BI Publisher. Show all posts
Showing posts with label BI Publisher. Show all posts

Tuesday, May 19, 2020

Dynamically Changing Font and Font Attributes


In the XDOUserGuide there is a section of Supported XSL-FO Elements (D1).  The section does not have any examples of how to use them.

I have created an example on how you may go about dynamically change the size of a font.

First I created a parameter called "fsize" to simulate varying the font size:

<?param@begin:fsize;string('20pt')?>


Below is the code that I will use.  It is mandatory that everything you see below is to go into a form field.


<fo:inline font-family="Arial" font-size="{$fsize}" font-weight="bold" font-style="italic"   hyphenate="yes "text-align="center">Now is the time for all good men to come to the aide of their comrades.</fo:inline>

The tricky part was to introduce the variable (fsize) into the markup. You have to encapsulate the variable with "{var}". Note that param's are referenced with a prefix of "$".



Friday, March 8, 2013

Dynamic Sorting


I am an advocate of sorting, aggregating, performing computations and arranging a hierarchy when  forming the xml data so that it does not have to be done in the RTF template.  This simplifies the xpath/xslt scripting that needs to be done in the RTF template.

On the other hand, there can be times you don't have control on how the xml data feed is built especially when the source you have to work with is the xml data.  The problem I faced is that the xml data was sent by Siebel integration via web services.  A requirement of a report was to dynamically change as to which data element to sort on depending on the setting of a parameter.


Snipet of  xml data
For this example I am using the parameter SortBy.  The option is to either sort on ENAME or MGR.  First I will declare the parameter on the RTF template like:
<?param@begin:SortBy;'"MGR"'?>

The sort goes right after the for loop:
<?for-each:ROW?>
<?sort:xdoxslt:ifelse($SortBy=’EMP’,ENAME,MGR);'ascending';data-type='text'?>
Yes it is that simple.  You might be asking where xdoxslt:ifelse comes from.  This is one of those many undocumented features.  As you can see, the way ifelse works is that if the comparison is true then ENAME else MGR.  You are are allowed to layer multiple ifelse's.

Another undocumented feature that I found when using the sort statement is lang='no'. So then it becomes: 
<?sort:xdoxslt:ifelse($SortBy=’EMP’,ENAME,MGR);'ascending';data-type='text',lang='no?>.  What does this do for you?  If the data element, that you're sorting on, contains alphanumeric characters, then sorting will not sort correctly.