BI Publisher Examples
Posted by jeggent on January 5, 2021
This post is intended to be a resource for myself and others with links and examples of BI Publisher template coding. Like the LISTAGG, Excel Formula, and PS Query Expression posts I intend on continuing to update this post as I encounter useful examples.
Links
Report Designer’s Guide for BI Publisher
Oracle Doc for Creating an RT Template
PeopleBooks on Creating Report Definitions
Example code
<?if:number(TOT_HOUS_ON)>0?> (compare a field to a number)
<?if@inlines: number(ISIR_TXN_NBR)>0 and fld_SCC_LETTER_CD=’FVE’?> (example with AND to check multiple things, @inlines suppresses NEWLINE so that you don’t get blank lines if the test fails)
<?if:number(SCCquery_BG_FA_SOAR_DATA_AWARDS/@numrows)>0?> (check to see if an additional data query returned any rows)
<?xdoxslt:set_variable($_XDOCTX,’COUNT’,0)?> (create a variable called COUNT that can be updated and checked)
<?xdoxslt:set_variable($_XDOCTX,’COUNT’,xdoxslt:get_variable($_XDOCTX,’COUNT’) + ISPLUS)?> (update the variable COUNT with the sum of the current value and the field ISPLUS)
<?if:xdoxslt:get_variable($_XDOCTX,’COUNT’)>0?> (check the value of the created variable COUNT)
<?if:substring(FIELDNAME,1,1)!= C?> (Check the first character of a field – note “!=” means does not equal)
<?xdofx:TUITION+472.55+ROOMAMT+PLANAMT?> (doing math with field values and static numbers)
<?html2fo:D.DESCRLONG?> (the field D.DESCRLONG contains HTML tags, this will display formatted by the tags instead of the HTML code)
<?xdofx:sysdate()?> – For System Date/time (select format in box)