【问题标题】:Standalone ELSE in BI Publisher RTF TemplatesBI Publisher RTF 模板中的独立 ELSE
【发布时间】:2018-10-11 17:56:39
【问题描述】:

我知道有一个IF-ELSE Statement in XML Publisher RTF Templates,如下所示:

<?xdofx:if ELEMENT1='A' then 'The Letter is A' else 'The Letter is not A' end if?>

但是,我希望使用IF 语句根据值显示不同的数据表。类似于下面的伪代码:

IF BUSINESS_GROUP IS BG-A THEN SHOW TABLE with COLUMNS A B and C, IF NOT, then SHOW TABLE with COLUMNS X Y and Z

我可以通过使用 2 个单独的 IF 语句来做到这一点:

<?xdofx:if BUSINESS_GROUP='A'> SHOW TABLE with COLUMNS A B and C <?end if?>

<?xdofx:if BUSINESS_GROUP!='A'> SHOW TABLE with COLUMNS X Y and Z <?end if?>

我希望我可以只使用像<?ELSE?> 这样的语句,但它不起作用。

有什么建议吗?

【问题讨论】:

    标签: oracle rtf obiee bi-publisher


    【解决方案1】:

    正如@Peter Paff 所展示的,<?choose:?> 是一个不错的选择。它可能有点“笨重”,但如果您需要添加更多条件,它似乎更容易遵循。

    对于您非常具体的条件还有另一个(可能是“笨重”)选项:如果您引用的 TABLE 是一个表,并且您只想根据条件显示/隐藏该表的某些列,您可以添加您希望显示(或隐藏)的每列(或列组)的条件:<?if@column:?>

    有关详细信息,请参阅Oracle Fusion Middleware Report Designer's Guide for Oracle Business Intelligence Publisher 12.2.1.2.0 -> Creating RTF Templates -> Using Conditional Formatting - 特别是关于格式化列的部分。

    【讨论】:

      【解决方案2】:

      你是对的,没有独立的“else”块。根据您的要求,您将需要使用 to if 表达式评估相反的条件。

      Here 列出了可以在 BIP 中使用 if 表达式的所有不同方式。

      【讨论】:

        【解决方案3】:

        以下满足您的功能要求,但不是if else 声明。

        <?choose:?>
           <?when: BUSINESS_GROUP='A'?>
              SHOW TABLE with COLUMNS A B and C
           <?end when?>
           <?otherwise:?>
              SHOW TABLE with COLUMNS X Y and Z
           <?end otherwise?>
        <?end choose?>
        

        这类似于其他编程语言中的 switch/case/evaluate 语句。

        【讨论】:

        • 只是补充一下,我相信 WHEN 不允许多个条件(即当 BUSINESS_GROUP = 'A' 和 SOURCE='X' 时)?
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-02-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-28
        • 1970-01-01
        相关资源
        最近更新 更多