Friday, June 29, 2012

XML Publisher conditional formatting

Conditional formatting in XML publisher can be handled by If and while statements
  1. If Statement
    • <?if:COLOR='RED'?>Y<?end if?>
  2. If-then-Else
    • <?if:COLOR='RED' then Y else N end if?>
    • Nested If-then-Else
      <?if:COLOR='RED' then Y else if COLOR = 'BLUE' then B else N end if?>
Combining If with <?xdofx:expression?> helps in scripting SQL statements. Refer below.
  1. Choose
    • <?choose:?>
      <?when:expression?>
      <?otherwise?>
    • Example
      <?choose:?>
            <?when:CLOLOR = ‘RED'?>
              'Y'
            <?end when?>
            <?when:COLOR = 'B'?>
              'B'
            <?otherwise?>
              'N'
            <?end otherwise?>
      <?end choose?>

BI Publisher has extended a set of SQL and XSL functions for use in RTF templates. The syntax for these extended functions is

<?xdofx:expression?>  --> for extended SQL functions or
<?xdoxslt:expression?> --> for extended XSL functions

  •  <?xdofx:if COLOR ='Y' then substr('ACCEPTED',1,6) else REJECT end if?>
Refer --> Exteneded Functions






4 comments:

  1. Can you help me figure out the syntax to use? I've done a lot of web searching and tried probably 30 iterations of this to try to make it work, all to no avail. All I want to do is print a field in red if another field has one value, or print the same field in regular text if the other field has a different value.

    CUM_GPA else CUM_GPA end if?>

    Thanks much!

    ReplyDelete
  2. Hm, lost part of the content...

    CUM_GPA else CUM_GPA end if?>

    Thanks much!

    ReplyDelete
  3. One more time...

    <?xdofx:if GPA_STATUS = 'F' then <fo:inline color="red"> CUM_GPA </fo:inline> else CUM_GPA end if?>

    ReplyDelete
  4. Hey,
    Please tell me any solution of this...
    "< ? if:SEX='F' then APPLY_CNT end if ? >"

    its not working.

    ReplyDelete