donderdag 23 augustus 2012

Bi Publisher: usefull commands


MSOffice: 2010

Usefull Commands

  • How to check the number of rows of a group?
    You want to know the number of rows that a group returns, to determine whether or not you want to show the for-each-loop or show something else.
    <?if:count(XML_GROUP_NAME)=0?><?end if?>
  • How to show/hide an entire section depending on a value?
    You are using sub-templates in your report.  You would like to hide or show such a sub-template depending on a parameter or a value. 
    <?call@inlines: details_common?><?end call?> 
    <?end if?> 
    Now you want to do the same thing, but your sub-template is using other section layouts, like page orientation (portrait, landscape).  So the result of the if statement should not only reflect the sub-templae, but also the section in which it resides.  Do the following:
    <section break (next page)>
    <?call@inlines: composition_common?><?end call?> 
    <?end if?>
    <section break (next page)>
  • How do I show a different template, depending on a parameter?
    We have imported an RTF containing different templates.  Depending on a parameter, we want to show one of the templates.  You can use the following construct:
    <?when: .// PRODUCT_VARIANT =’productTab’?> <?call: product_common?> <?end when?>
    <?when: .// PRODUCT_VARIANT =’variant_a’?> <?call: product_variant_a?> <?end when?>
    <?when: .// PRODUCT_VARIANT =’variant_b’?> <?call: product_variant_b?> <?end when?>
    <?when: .// PRODUCT_VARIANT =’variant_c’?> <?call: product_variant_c?> <?end when?>
    <?end choose?>
  • How do I publish HTML-enabled content in my report ?
    We have a column containing in the database containing text with HTML-tags in.  We want to interprete these HTML-tags in our template.  For example: This is <b>bold</b>.
    • Make the column NCLOB capable.  You can perform this with a varchar2 or a clob column.

      select to_nclob(t.html_column) as "my_html"
      from my_table t;
    • Set the dataType in the datamodel

      <element name="my_html" dataType="xdo:xml"
    • Import the XSLT file to transform the HTML into RTF code.  You can do the import in the header of the page.  See this blog for an example of such a XSLT file.
    • In the template (RTF-layout), use the following field code
      <xsl:apply-templates select=".//MY_HTML"/>
      Attention: make sure you use the // or .// notitation.  Without it, it doesn't work.
  • How do I show an image in my report, that is comming from a blob column in the database?
    I want to show an image, that is stored as a blob-column in a database table.
    The following code, which you can use in your template assumes that the image is a jpeg.
    <fo:instream-foreign-object content-type="image/jpg"
    xdofo:alt="An Image">
    <xsl:value-of select=".//SIGNATUREIMG"/>

6 opmerkingen:

  1. Great Post - but in the second command you have the line

    is this supposed to be actual code or is it ment to represent what shows up in Word anter inserting a Section Break ?

    1. the above post did not post correctly the blank line is supposed to contain
      < section break (next page) >
      lets see if it posts this time ,,,,

    2. It is your normal Word section break, no special command.

      It looks confusing.


  2. Hi filip I have some doubts..Can I plz have your email id...Reply ASAP..Thanks in advance

  3. Filip,
    I need some help... see bellow it is not working for me on RTF template.