模板嵌套分组与排序选项

时间:2016-01-19 08:28:44

标签: sorting nested-loops rtf bi-publisher

我想使用RTF模板生成一个报告,如下所示:

预期产出:

US
Cover   Insured
123456  INS1, INSB, INSA
987654  INS2

or

US
Cover   Insured
123456  INS1
        INSB
        INSA
987654  INS2

此处“保险”数据存在于父级和子级层次结构中,具有不同的标记名称。应首先显示父“InsuredAccnt”(我的XML中的INS1),然后显示子项“InsuredAccounts”,它将按“共享” - 降序排序。

XML:

<?xml version="1.0" encoding="UTF-8" ?> 
<InsuredReport>
<GroupPolicies>
  <Cover>123456</Cover> 
  <Customer>Customer</Customer>
  <InsuredAccnt>INS1</InsuredAccnt>       
  <Organization>US</Organization> 
  <ListOfGroupPolicies_InsuredAccount>
     <GroupPolicies_InsuredAccount>
        <InsuredAccount>INSA</InsuredAccount> 
        <Share>5</Share> 
     </GroupPolicies_InsuredAccount>
     <GroupPolicies_InsuredAccount>
        <InsuredAccount>INSB</InsuredAccount> 
        <Share>20</Share> 
     </GroupPolicies_InsuredAccount>
  </ListOfGroupPolicies_InsuredAccount>
</GroupPolicies>
<GroupPolicies>
  <Cover>987654</Cover> 
  <Customer>ABC</Customer>
  <InsuredAccnt>INS2</InsuredAccnt>       
  <Organization>US</Organization> 
  <ListOfGroupPolicies_InsuredAccount />
</GroupPolicies>
</InsuredReport>

我不确定如何上传所使用的RTF,但这是一个相同的要点:

RTF:

<?for-each-group:GroupPolicies;./Organization?>

Grouping within Table based on Cover
<?for-each-group:current-group();./Cover?>

Displaying "Insured"
<?InsuredAccnt?>
<?for-each-group:current-group();./GroupPolicies_InsuredAccount?><?sort: Share?><?InsuredAccount?><?end for-each-group?>

当我提出这个时,我的系统会永远运行,我被迫杀死会话。 请有人指出我错在哪里。

1 个答案:

答案 0 :(得分:0)

我能够使用以下内容实现所需:

<?InsuredAccnt?>
<?for-each:GroupPolicies_InsuredAccount?><?sort:Share;'descending';data-type='number'?><?InsuredAccount?><?end for-each?>

第二次不需要Current-Group()标记。这产生输出#2,即一个接一个地显示“InsuredAccounts”。