代码之家  ›  专栏  ›  技术社区  ›  Migs Isip

BI Publisher RTF模板中的独立ELSE

  •  1
  • Migs Isip  · 技术社区  · 7 年前

    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

    我可以通过使用两个独立的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?> 但它不起作用。

    有什么建议吗?

    3 回复  |  直到 7 年前
        1
  •  1
  •   Moonpie    7 年前

    正如@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
  •  1
  •   Ranjith R    7 年前
        3
  •  0
  •   Based    7 年前

    以下满足您的功能需求,但它不是 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语句相当。