Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Getting values from other datasets(Get a total value from multiple values in other datasets.)
Getting values from other datasets [message #1068061] Thu, 11 July 2013 21:06 Go to next message
Junior Martinez is currently offline Junior MartinezFriend
Messages: 8
Registered: May 2012
Junior Member
Hello,

I need help with my report. I have three datasets/tables in my report. Each dataset has an amount that I would like to do get and and put into a fourth table with for a remaining balance. So I will show an example below.

DataSet1/Table 1
Vendor , Description, VendorID, Purchase Limit

DataSet2/Table 2
Vendor, Description, VendorID, Spent Amount

DataSet3/Table
Vendor, Description,VendorID, Invoice Amount

I want to have a 4th table or insert a data binding that has a remaining balance of
Purchase Limit - Spent Amount - Invoice Amount = Remaining Balance for Vendor

I don't know how to get attributes from different tables, can anyone help, please?

I have attached my design file. Any help would be greatly appreciated.
Re: Getting values from other datasets [message #1068064 is a reply to message #1068061] Thu, 11 July 2013 21:35 Go to previous messageGo to next message
Kristopher Clark is currently offline Kristopher ClarkFriend
Messages: 130
Registered: January 2013
Senior Member
In the initialize() you could create three ArrayList PGV's like this

var array1 = new java.util.ArrayList();
var array2 = new java.util.ArrayList();
var array3 = new java.util.ArrayList();
reportContext.setPersistentGlobalVariable("array1", array);
reportContext.setPersistentGlobalVariable("array2", array);
reportContext.setPersistentGlobalVariable("array3", array);


Then recall each of them in the onRender() of purchase limit, spent amount, and invoice amount.

var purchaseLimit = reportContext.getPersistentGlobalVariable("array1");
purchaseLimit.add(this.value());
reportContext.setPersistentGlobalVariable("array1", purchaseLimit);


Then do the same for the other two and you should be able to call these back to preform some calculations with them later in your report.
Re: Getting values from other datasets [message #1068238 is a reply to message #1068064] Fri, 12 July 2013 19:08 Go to previous messageGo to next message
Junior Martinez is currently offline Junior MartinezFriend
Messages: 8
Registered: May 2012
Junior Member
Kris,

The spent and invoice fields on those two tables are being summed in my SQL. Will the array affect that?

My report should look like the this

Vendor Description Vendor Id Purchase Limit Spent Invoice Remaining Balance
A Description 1213-064 25,000 1000 1000 23000
Re: Getting values from other datasets [message #1068289 is a reply to message #1068064] Fri, 12 July 2013 22:28 Go to previous messageGo to next message
Junior Martinez is currently offline Junior MartinezFriend
Messages: 8
Registered: May 2012
Junior Member
Kris,

The spent and invoice fields on those two tables are being summed in the SQL code. Will the array affect that or do I need an array at all? I should of been clear on my post on the purchase limit field. The Purchase Limit field is just a field I'm getting from the in the SQL code. The spent and invoice fields are sum functions in the SQL code.



Re: Getting values from other datasets [message #1071303 is a reply to message #1068289] Fri, 19 July 2013 19:40 Go to previous messageGo to next message
Kristopher Clark is currently offline Kristopher ClarkFriend
Messages: 130
Registered: January 2013
Senior Member
Sorry for the late reply. If they are being summed in your SQL code this won't be effected by the arrays. They should get the summed values. Do those table have multiple rows or are they just one row showing the summary? Can you provide some sample XML data for me to build an example report?
Re: Getting values from other datasets [message #1072484 is a reply to message #1071303] Mon, 22 July 2013 21:36 Go to previous message
Junior Martinez is currently offline Junior MartinezFriend
Messages: 8
Registered: May 2012
Junior Member
Hey Kris,

The global variable you provided was just what I needed. I didn't need the array after all but I got what I needed to show up on my report.

Thanks Kris
Previous Topic:Problem with integration BIRT to webapp. NPE without stacktrace
Next Topic:PDF export of report with grid doesn't work correctly if cell is broken across two pages
Goto Forum:
  


Current Time: Fri Apr 19 23:25:22 GMT 2024

Powered by FUDForum. Page generated in 0.03151 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top