2011/06/09

条件文 (IF, CHOOSE and DECODE)

BI Publisher では、条件文の記載方法に幅があります。以下に、IF、CHOOSE、DECODE、およびその他の関数の構文を一覧します。

【IF文】
XSL文法の構文は以下の通りです。
<xsl:if test="expression"></xsl:if>

BI Publisher 文法の構文は以下の通りです。
<?if:expression?><?end if?>

拡張SQL関数の構文は以下の通りです。
<?xdofx:if expression then result1 else result2 end if?>

拡張XSL関数では以下の構文も使用できます。
<?xdoxslt:ifelse(expression ,true result, false result)?>


【CHOOSE文】
XSL文法の構文は以下の通りです。
<xsl:choose>
  <xsl:when test="expression"></xsl:when>
  <xsl:otherwise></xsl:otherwise>
</xsl:choose>

BI Publisher文法の構文は以下の通りです。
<?choose?>
  <?when:expression?><?end when?>
  <?when:expression?><?end when?>
  <?otherwise?><?end otherwise?>
<?end choose?>


【DECODE関数】
decodeも使用できます。
<?xdofx:decode(string1, string2', string3, ...)?>


【LIKEに相当する関数】
文字列の部分一致を判定するには、starts-with またはcontainsを使用します。
<?if:starts-with(string1, string2)?><?end if?>
<?if:contains(string1, string2)?><?end if?>


【参考】
サンプルやより詳細な情報のため、以下にいくつかのURLを記載します。
日本語マニュアル
http://download.oracle.com/docs/cd/E17159_01/doc/bi.1013/b51053/T421739T481158.htm

OTNスレッド
http://forums.oracle.com/forums/thread.jspa?messageID=3928083
http://forums.oracle.com/forums/thread.jspa?messageID=9564511

containsやstarts-withに関する情報
http://blogs.oracle.com/xmlpublisher/entry/wildcards

XPath文字列関数の一覧
http://www.quackit.com/xml/tutorial/xpath_string_functions.cfm


[Summary]
There are many ways to write condition with BI Publisher.  I list the formula of IF, CHOOSE and other functions.


[IF statement]
XSL syntax:
<xsl:if test="expression"></xsl:if>


BI Publisher syntax:
<?if:expression?><?end if?>


Expression in Extended SQL function:
<?xdofx:if expression then result1 else result2 end if?>


Expression in Extended XSL function:
<?xdoxslt:ifelse(expression ,true result, false result)?>




[CHOOSE statement]
XSL syntax:
<xsl:choose>
  <xsl:when test="expression"></xsl:when>
  <xsl:otherwise></xsl:otherwise>
</xsl:choose>


BI Publisher syntax:
<?choose?>
  <?when:expression?><?end when?>
  <?when:expression?><?end when?>
  <?otherwise?><?end otherwise?>
<?end choose?>




[DECODE function]
With Extended SQL function, you can use decode.
<?xdofx:decode(string1, string2', string3, ...)?>




[LIKE Equivalent]
starts-with and contains functions are available.
<?if:starts-with(string1, string2)?><?end if?>
<?if:contains(string1, string2)?><?end if?>




[Reference]
For more details and samples, please see the following URL.


Manual (English):
http://download.oracle.com/docs/cd/E10383_01/doc/bip.1013/b40017/T421739T481158.htm


OTN threads:
http://forums.oracle.com/forums/thread.jspa?messageID=3928083
http://forums.oracle.com/forums/thread.jspa?messageID=9564511


contains and starts-with
http://blogs.oracle.com/xmlpublisher/entry/wildcards


XPath functions:
http://www.quackit.com/xml/tutorial/xpath_string_functions.cfm

0 件のコメント:

コメントを投稿