How to generate dynamic columns using RML report?
Asked
Active
Viewed 4,090 times
2
-
@AnomA Its like a table suppose I select a month and it is january so 31 column is displayed or its february so 28 columns is displayed..!! – Abhishek Mehta May 16 '12 at 05:02
1 Answers
2
Read through the developer documentation on dynamic content in reports. You can use the repeatIn()
function to loop over your dates, but the trick will be adjusting column widths. I suspect you can change the colWidths
attribute of the table using the setTag()
function.
Here's an example where I used it to change the table style.
<section>
[[ repeatIn(lines(data['form'],object=o), 'a') ]]
<blockTable>
[[ setTag('blockTable','blockTable',{'colWidths': '80.0,150.0,80.0', 'style': 'Table' + str(a['level'] if a['level'] <= 5 else 5)}) ]]
<tr>
<td lineAboveColor="#000000" lineAboveThickness="5" lineAboveCount="1" lineAboveSpace="5">
<para style="P10"><font>[[ setTag('font','font',{'face':o.font_style or 'Helvetica', 'color':o.color_font.name or 'black', 'backColor':o.color_back.name or 'white'}) ]] [[ a['code'] ]]</font></para>
</td>
<td>
<para style="P17"><font color="white">[[ '..'*(a['level']-1) ]]</font><font>[[ setTag('font','font',{'face':o.font_style or 'Helvetica', 'color':o.color_font.name or 'black', 'backColor':o.color_back.name or 'white'}) ]] [[ a['name'] ]]</font></para>
</td>
<td>
<para style="P18"><font>[[ setTag('font','font',{'face':o.font_style or 'Helvetica', 'color':o.color_font.name or 'black', 'backColor':o.color_back.name or 'white'}) ]][[ '%.2f'% a['balance'] ]]</font></para>
</td>
</tr>
</blockTable>
</section>

Don Kirkby
- 53,582
- 27
- 205
- 286