Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
DOM Datasource: How to sum the column values
sriram nagappan
<p>Hi Team,</p>
<p> </p>
<p>I have a report using DOM based Data source, in which i have a Grid which has one column and each row is binded with the DOM based data source since the input to Data Set Parameter Binding is different. I need to sum all these columns and display in the last row. Can you please confirm if there is any script available for storing the value populated at each row and sum the values and display in the last row.</p>
Find more posts tagged with
Comments
Clement Wong
<p>Create a footer row in your table. Then, you can just insert an Aggregation report item, with SUM as the function, and the Expression as the column you want to total.</p>
sriram nagappan
<p>Hi,</p>
<p>I am not using DB datasource. The datasource is based on DOM (Document Object Model) and each data element is individually binded to the DOM dataset. So i am not sure which datasource i need to bind and what expression to use. I have a idea to use Global variable and store the value populated at each data element and finally display the stored variable at the last row </p>
sriram nagappan
<p>Hi</p>
<p>In continuation to ablove.</p>
<p>I need help how to declare global variable and store the value populated at each data item and sum it and display in another data element</p>
Clement Wong
<p>I was assuming you were using a Scripted Data Source / Data Set. You can't create Computed Columns for a Script Data Set so you'll need to follow my suggestion from the previous post.</p>
newbie321
<blockquote class="ipsBlockquote" data-author="sriram nagappan" data-cid="140635" data-time="1450541148">
<div>
<p>Hi</p>
<p>In continuation to ablove.</p>
<p>I need help how to declare global variable and store the value populated at each data item and sum it and display in another data element</p>
</div>
</blockquote>
<p> </p>
<p>As far as I know this is how you create local and global variables in BIRT through script:<br><br>
number =55; // global variable</p>
<p>var number =55; // local variable</p>
<p> </p>
<p>so as you can see the keyword 'var' determines the scope of the variable. Birt uses Rhino Javascript. </p>
<p> </p>
<p>Hope this helps,</p>
newbie321
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="140787" data-time="1450720768">
<div>
<p>I was assuming you were using a Scripted Data Source / Data Set. You can't create Computed Columns for a Script Data Set so you'll need to follow my suggestion from the previous post.</p>
</div>
</blockquote>
<p> </p>
<p>I am not sure if this does the trick, but there is a way to add more columns to the scripted data set. The calls are: </p>
<p> </p>
<p>StructureFactory.createResultSetColumn();</p>
<p>StructureFactory.createComputedColumn();</p>
<p>StructureFactory.createColumnHint();</p>
<p> </p>
<p>etc etc. Please note, the above are just methods listings, not the actual program flow... </p>
<p> </p>
<p>The complete API ref can be found at <a data-ipb='nomediaparse' href='
http://help.eclipse.org/mars/index.jsp'>http://help.eclipse.org/mars/index.jsp</a>under
Birt Programmer Reference.</p>
<p> </p>
<p>Hope this helps, </p>
Clement Wong
<p><strong>
@newbie321<
;/strong></p>
<p>Sorry, you are correct. What I meant was you can't create Computed Columns for a Scripted Data Set from the UI.</p>
<p> </p>
<p><strong>
@sriram
nagappan</strong></p>
<p>There's no need for your design because I replied to your other thread that did have the design and sample data. The attached design in <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/37949-binding-with-scripted-data-set/?p=140793'>http://developer.actuate.com/community/forum/index.php?/topic/37949-binding-with-scripted-data-set/?p=140793</a></p>
;
<p>includes the total amount, which was added via the method in <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/37773-dom-datasource-how-to-sum-the-column-values/?p=140603'>post
#2</a> above.</p>