Don Boots
Don Boots

Reputation: 2166

Creating a BIRT using query params

I'm to a query multiple times from a single query in BIRT. For example, my DB2 query could be SELECT * FROM GROUPS and my dataset would look like

id  |  name
1   |  group 1
2   |  group 2

From that dataset I'd like to run another query for each row. So maybe something like SELECT * FROM ORDERS WHERE group_id = params['id'] where id is id of the current GROUP record.

The actual report would look something like:

Order for Group 1
01/01/2015  Order #321
01/15/2015  Order #948

Orders for Group 2
01/02/2015  Order #123
01/23/2015  Order #456

I'm fairly new to BIRT and have seen examples of using scripts on certain events (beforeOpen, etc), but I wanted to make sure that was the proper way to go for something this rudimentary.

Upvotes: 0

Views: 76

Answers (1)

James Jenkins
James Jenkins

Reputation: 1954

Grouping on Groups in my example and OP's question, read carefully.

From what I understand of your requirements probably the easiest way to get what you want it to group on the table.

Put your fields in the data set and on the table then 'group by' elements of the table.

The report below is grouped by date and UPMC_Assign, then I count the number of INCIDENT_ID (ticket owner is criteria that is not displayed)

Create your 'Data Set', drop the Data Set on the Layout, a table is auto created.

Add a 'Group' (red circle lower part of second image), in my case I grouped by Date then by Group, in your case you would group by your 'Group'

I added an aggregation from the Palette to get counts. You can delete anything from the table you don't want. In my case i started out with a line for every ticket, but I deleted the entire row, and just show the groups and counts.

See my answer here for suggestions on versioning reports during development.

enter image description here

enter image description here

Upvotes: 1

Related Questions