BI Publisher - Display Data Horizontally

2019-08-27 08:06发布

问题:

I have the following data model:

<SALE_LIST>
    <SALE>
        <YEAR>2010</YEAR>
        <ITEM>100001</ITEM>
        <AMOUNT>1,199.00</AMOUNT>
    </SALE>
    <SALE>
        <YEAR>2010</YEAR>
        <ITEM>100002</ITEM>
        <AMOUNT>1,200.00</AMOUNT>
    </SALE>
    <SALE>
        <YEAR>2012</YEAR>
        <ITEM>100001</ITEM>
        <AMOUNT>1,899.00</AMOUNT>
    </SALE>
    <SALE>
        <YEAR>2012</YEAR>
        <ITEM>100003</ITEM>
        <AMOUNT>1,649.00</AMOUNT>
    </SALE>
    <SALE>
        <YEAR>2013</YEAR>
        <ITEM>100004</ITEM>
        <AMOUNT>2,199.00</AMOUNT>
    </SALE>
    <SALE>
        <YEAR>2013</YEAR>
        <ITEM>100005</ITEM>
        <AMOUNT>3,199.00</AMOUNT>
    </SALE>
</SALE_LIST>

In rtf template, using for-each to display all YEAR:

<?for-each:SALE?>
<?YEAR?>
<?end for-each?>

Normally, the result will be displayed vertically, like this:

2010
2010
2012
2012
2013
2013

How to display the result horizontally, like this: 2010 2010 2012 2012 2013 2013

回答1:

<?for-each@inlines:SALE?>
<?YEAR?>
<?end for-each?>

If you want to print the values in horizontal table columns, you will need dynamic columns. You will have to use:

<?split–column–header:name?>
<?split–column–data:name?>

If you have installed BIP Word addon on your windows system, you will have the sample templates provided by Oracle. Go down to you BI Publisher Desktop folder, and check the samples folder. On my system, the location is:

C:\Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\samples\RTF templates\Advanced\Dynamic Columns

There will be a Dynamic Data Columns.doc file there, which explains neatly how to do this.