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)
Sum value in Table but display in the Master Page Header
earthp
<p>In table I have a field which is a weight in Kg and I want to sum the weight and display in the header of the master page. I think I need to use the global variables but I still cannot make it display.</p>
<p> </p>
<p>Anybody could help me with this? </p>
<p>thank you in advance</p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
PaulCooper
<p>earthp,</p>
<p> </p>
<p>You need to add an aggregate binding to the table and then add a field in the header using that binding.</p>
<p> </p>
<p>To do that (my apologies if I am being too basic for you):</p>
<ol><li>Click on the "Table" tab at the bottom left corner of the table.</li>
<li>In the set of tab in the Properties Editor (usually below) there should be a Binding tab. Click on that.</li>
<li>The Data Set should already be selected but select it if not.</li>
<li>To the right of the list of bindings there is an "Add Aggregation" button. Click it.</li>
<li>This should bring up the "Aggregation Builder".</li>
<li>Give the binding a unique name, select the data type (Float should do), select the aggregate function (SUM), and then select the field (your weight field) as the expression (The dropdown should provide it but you can use the Expression Builder if necessary)</li>
<li>Then select the "Aggregate On". From what you said it sounds like you want a total for the whole table so leave it as "Table".</li>
<li>Click OK to save it.</li>
<li>Now in the table add a Data Item from the Palette into the place in the header you want the total.</li>
<li>This will bring up the "New Data Bindings" dialog. Cancel it.</li>
<li>Right-Click on the empty Data Item and select "Change Data Column" from the popup menu.</li>
<li>This will bring up the "Select Data Binding" dialog. From this dialog select the new binding you created earlier in step 6 and click OK</li>
<li>You should now have a total in the header.</li>
</ol><p>You may want to format the number of this aggregate field which you can do from the Properties Editor.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>Paul</p>
earthp
<p>Thank you very much Paul</p>
<p> </p>
<p>However, the place where I want to put total weight is not in the table header. I need to put it in the Master Page Header.</p>
PaulCooper
<p>My bad. I missed that point about the master page (not that you'd written that many words!). I will try and find a solution for you.</p>
PaulCooper
<p>OK I have figured it out for you. Here are the steps:</p>
<ol><li>In the master page right-click and add a data item.</li>
<li>Cancel the "New Data Bindings" dialog that pops-up.</li>
<li>Right-Click on the empty Data Item and select "Change Data Column" from the popup menu.</li>
<li>This will bring up the "Select Data Binding" dialog.</li>
<li>Select the data set.</li>
<li>Click on "Add Aggregation".</li>
<li>Give the binding a unique name, select the data type (Float should do), select the aggregate function (SUM), and then select the field (your weight field) as the expression (The dropdown should provide it but you can use the Expression Builder if necessary)</li>
<li>You cannot change the "Aggregate On" field.</li>
<li>Click OK to save it.</li>
<li>Back at the "Select Data Binding" dialog select the new aggregate binding using the tick box in the first column and click OK.</li>
</ol><p>If you preview the report it should now contain a total in the master page header. The only downside from this (and this may be just my version of BIRT (3.7.2)) is that you cannot add a second field in the header so you may instead, between steps 9 and 10 above, create a second binding (non-aggregate) that concatenates text with the aggregate binding field you created previously and then use that binding in step 10.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>Paul</p>
earthp
<p>Thank you so much Paul.</p>
<p> </p>
<p>I've already try and it's work!!!</p>
<p> </p>
<p> </p>
<p>Best Regards,</p>
<p> </p>
<p>Earth</p>
snehal1312
<p>Hi, I am trying the same thing i.e I want to display sum shown at the footer of table at header of table. I tried the above solution but it not worked for me.can u help it out? </p>
jfranken
<p>If you have the computed sum in the footer of the table and you want the sum in the header of the table, you should be able to drag the aggregation to the header. Attached is a sample report that displays a computed sum in the table header. The data is from the built in Classic Models DB. I inserted a new header row for the sum and added a label. </p>
<p> </p>
<p>You can also cut and paste the aggregation into the Master Page header if that is the goal. In that case you need to change the data column as described in the old thread. </p>
<p> </p>
<p>If you have any questions, let me know.</p>
snehal1312
<p>hi franken,</p>
<p> </p>
<p>that worked for me.thank you so much. also one more thing, this total I have to show at 2 more places i.e on master page header and footer.there I am using the different dataset in which i don't have this computed column to use. then how can i show total there? thanks in advance.</p>