Monday, 30 September 2013

Different type of xml tags in bi publisher

Not null:

<?if@column:G_MON1_QTY_MON1!=''?>

If not null

<?xdoxslt:ifelse(UNIT_PRICE!='',UNIT_PRICE,0)?>

If null then

<?xdoxslt:ifelse(UNIT_PRICE ='',UNIT_PRICE,0)?>

<?xdofx:if TOTAL_COST = '' then 0 end if?>

<?xdofx:if TOTAL_COST = '' then TOTAL_COST= 0 end if?>

If with < or > process

<?xdofx:if ITEM_COST <10 then 'John' else 'Smith' end if?>

write decode condition in xml tag

<?xdofx:Decode(tag_name ,'',0,tag_name?>

tamplate with matrix format

<?for-each-group:G_SUPPLIER;ITEM?>// Group name;column name //

cross table xml tag Row act as column process in xml tag
<?for-each-group@column:G_SUPPLIER;PO_CREATION_MONTH?> // group name;column name //

<?for-each-group@cell://G_BUDGET;./TASK_NAME?>

cross table xml tag Row act as column with other details

<?for-each-group@cell:current-group();PO_CREATION_MONTH?>


section command in xml tag:
<?for-each-group@section:G_1;./FK_REF_REGION_CODE?>

<?if@section:count(//G_1)=0?>No Data Found<?end if?>

<?end for-each-group?>


Detail Solution

 I am giving this solution for Standard Check Printing Report. Tree structure of data (Sample XML data is as follow).

<LIST_G_CHECKS>

    <G_CHECKS>  -- Top Most root -- Header

      <C_CHECK_NUMBER>21897</C_CHECK_NUMBER>

      <C_VENDOR_NUMBER>2205</C_VENDOR_NUMBER>

      <LIST_G_INVOICES>

        <G_INVOICES> -- Inner loop - Line Section

          <C_PAYMENT_NUMBER>1</C_PAYMENT_NUMBER>

          <C_INVOICE_NUMBER>ERS-20-SEP-06-243</C_INVOICE_NUMBER>

        </G_INVOICES>

        <G_INVOICES> -- Inner loop - Line Section

          <C_PAYMENT_NUMBER>2</C_PAYMENT_NUMBER>

          <C_INVOICE_NUMBER>ERS-20-SEP-06-244</C_INVOICE_NUMBER>

        </G_INVOICES>

      </LIST_G_INVOICES>

    </G_CHECKS>

</LIST_G_CHECKS>



Below is the step-step guide which I follow.



1) Open the Outermost for loop --  G_CHECKS

<?for-each@section:G_CHECKS?>



2) Declare Global Variable called ‘no_of_lines_per_page’  -- In this case I have fixed 40 lines per page.

<xsl:variable name="no_of_lines_per_page" select="number(40)"/>



3) Declare incontext variable for inner group (G_INVOICES), variable is called ‘inner_group’

<xsl:variable xdofo:ctx="incontext" name="inner_group” select=".//G_INVOICES"/>



4) Open the Inner Loop

   <?for-each:$inner_group?>



5) Before putting any elements with the help of current record pointer 'position()’, I am checking if the current position is modulizing with the no_of_lines_per_page equals zero or not. If it reaches the first record after modulizing then I will create local variable 'first_rec' and initialize it with '0'.

<?if:(position()-1) mod $no_of_lines_per_page=0?><xsl:variable name="first_rec" xdofo:ctx="incontext" select="position()"/>



Note : -- Above 3 steps ( 3,4,5) are created under ‘V_inner_group_And_V_First_rec’ form-field. Here there is limitation of Microsoft-word. We can enter upto 138 characters only in ‘Status’ field of ‘Add help text’ button.If you want to add more , you can do this by clicking on ‘Help Key’  which is adjacent to ‘Status’ tab.



6) If above condition holds true then we will iterate the inner loop.

<?for-each:$inner_group?>



7) I will check with the help of current record pointer 'position()' that the current record position is either greater than 'first_rec' i.e. the first record or less the 'no_of_lines_per_page' value set up earlier. If it is then show the record otherwise not otherwise it will not go in loop.

   <?if:position()>=$first_rec and position()<$first_rec+$no_of_lines_per_page?>



8) Here I am closing the inner for loop and if condition

   <?end if?><?end for-each?>



9) Here I am checking if no_of_lines of invoice is modulizing with the no_of_lines_per_page equals to zero or not ,and the same time I am checking if $first_rec+$no_of_lines_per_page is greater than no_of_lines of invoice or not. This is important step for filling the blank rows.

<?if:not(count($inner_group) mod $no_of_lines_per_page=0) and ($first_rec+$no_of_lines_per_page>count($inner_group))?>





10) Now I am calling sub-template recursively for filling the blank rows. While calling this template I am passing one parameter which is having value of no_of_rows to fill. Sub-template will have just one row table.

<xsl:call-template xdofo:ctx="inline" name="countdown"><xsl:with-param name="countdown" select="$no_of_lines_per_page - (count($inner_group) mod $no_of_lines_per_page)"/></xsl:call-template>



11) Sub-template declaration

   <xsl:template name="countdown">

   <xsl:param name="countdown"/><xsl:if test="$countdown"><xsl:call-template  

   name="countdown"><xsl:with-param name="countdown" select="$countdown - 1"/> 

   </xsl:call-template></xsl:if>

   </xsl:template>



12) I have created page break after the fixed number of rows have been displayed.

   <xsl:if xdofo:ctx="inblock" test="$first_rec+$no_of_lines_per_page<=count($inner_group)">

      <xsl:attribute name="break-before">page</xsl:attribute>

   </xsl:if>



13) Finally closing outer if and inner for loop and outer for loop.

   <?end if?><?end for-each?><?end for-each?>

You can use IF condition directly or using xdofx in RTF Template. Below are few examples

(?xdofx:if LENGTH(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/POH_CUSTOMER)=0 THEN 'DELIVER TO:'POD_REQUESTOR_NAME'('POD_QUANTITY_ORDERED')' END IF?)


(?xdofx:if LENGTH(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/POH_CUSTOMER) !=0 AND(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/POH_CUSTOMER)!=POD_REQUESTOR_NAME THEN 'DELIVER TO:'POD_REQUESTOR_NAME'('POD_QUANTITY_ORDERED')' END IF?)


(?if:string-length(/XXBRPRPOP/LIST_G_INIT_INFO/G_INIT_INFO/LIST_G_HEADERS/G_HEADERS/LIST_G_CANCEL_RELEASE/CANCEL_RELEASE_DATE)!=0?)


(?xdofx:if AMOUNT > 1000 then ’Higher’
else
if AMOUNT < 1000 then ’Lower’
else
’Equal’
end if?>


Note: Replace symbol '(' with '<' and ')' with '>' for starting and ending Tags above

2 comments:

  1. BI Publisher definitely insists a drive to move through the soul of Oracle Reports. Oracle’s statement of direction, illustrates Reports will move on supporting for a longer periods of time, but if you can’t experience the simple touching asking you to go with applications like JDeveloper, ADF, and J2EE compliance, will leave you behind the race when compared with other competitors.
    Visit us @ http://www.sronlinetraining.com/bi-publisher/

    ReplyDelete
  2. Informatica Online Training is now very advanced module which is providing by real time experts in Smart Mind Online Training by explaining real time projects.Informatica Online Training faculty are with great experinced in Smart Minds.You can reach us @IND:+91-9949599844,USA:+1-347-606-2716,Email:contact@smartmindonlinetraining.com

    ReplyDelete