Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Duplicate detail row
fro
<p>Hello,</p>
<p> </p>
<p>I design a report for printing item label.</p>
<p> </p>
<p>I would like to duplicate each detail row with a report parameter that define how many time each Item repeating.</p>
<p> </p>
<p>Example :</p>
<p> </p>
<p>Value of report parameter (Qty of label by item) : 3</p>
<p> </p>
<p>-label_item1</p>
<p>-label_item1</p>
<p>-label_item1</p>
<p>-label_item2</p>
<p>-label_item2</p>
<p>-label_item2</p>
<p>-label_item3</p>
<p>-label_item3</p>
<p>-label_item3</p>
<p> </p>
<p>How can i achieve this ?</p>
<p> </p>
<p>Thanks.</p>
Find more posts tagged with
Comments
Clement Wong
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/user/49613-matthew-l/'>Matthew</a>
; and I discussed this. You can get a handle to the detail row of the table in the beforeFactory and clone it (copy a row, insert a row, and paste a row).</p>
<p> </p>
<p>Here's how you would clone a single row (for example):</p>
<pre class="_prettyXprint">
importPackage( Packages.org.eclipse.birt.report.model.api );
table = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("myTable");
elementFactory = reportContext.getReportRunnable().designHandle.getElementFactory();
tableHeaderRow = new RowOperationParameters(0, -1, 0); // Header row (First arg: 0 is the HEADER, 2 is DETAIL, 3 is FOOTER, Second arg is group, Third arg is slot number)
tableDetailSource = new RowOperationParameters(2, -1, 0); // Detail row (Slot is 0)
tableDetailDestination = new RowOperationParameters(2, -1, 1); // Detail row NEW (New Slot so it's 1);
rowSource = table.copyRow( tableDetailSource );
table.insertRow( tableDetailDestination );
table.pasteRow( rowSource, tableDetailDestination );</pre>
<p>Here's how you would clone the source row multiple times:</p>
<pre class="_prettyXprint">
importPackage( Packages.org.eclipse.birt.report.model.api );
table = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("myTable");
elementFactory = reportContext.getReportRunnable().designHandle.getElementFactory();
for(var i=1; i<params["NumberOfTimes"].value; i++){
rowSource = table.copyRow( new RowOperationParameters(2, -1, (i-1)) );
table.insertRow( new RowOperationParameters(2, -1, i) );
table.pasteRow( rowSource, new RowOperationParameters(2, -1, i) );
}</pre>
<p>Attached are two sample designs (tested with commercial BIRT iHub 3.1 and OS BIRT 4.4.x) for reference.</p>
<p> </p>
fro
<p>That resolve my problem,</p>
<p> </p>
<p>Thanks Clement.</p>