1

I would like to generate a report using RTF Template which looks like the below:

Expected Output:

US
Cover   Insured
123456  INS1, INSB, INSA
987654  INS2

or

US
Cover   Insured
123456  INS1
        INSB
        INSA
987654  INS2

Here "Insured" data is present both in Parent and child hierarchy with different tag names. Parent "InsuredAccnt" (INS1 in my XML) should be displayed first followed by child "InsuredAccounts" which will be sorted by "Share" - Descending.

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>

I am not sure how to upload the RTF used, but this is a gist of the same:

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?>

When I give this, my system runs forever and I am forced to kill the session. Please could someone point out where I am wrong.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Anna Joel
  • 107
  • 3
  • 14

1 Answers1

1

I was able to achieve the desired using the following:

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

The Current-Group() tag was not needed a second time. This produces Output # 2, i.e displaying the "InsuredAccounts" one after the other.

Anna Joel
  • 107
  • 3
  • 14