views:

75

answers:

2

I need help in creating a BIRT report; the situation is that I have multiple queries but the report all columns should be grouped by One column for example (Operator) Like :

Operator | Expr1 | Expr2 | Expr3 | Expr4 |

op1 | ## | ## | ## | ## |

op2 | ## | ## | ## | ## |

op3 | ## | ## | ## | ## |


How can i accomplish that ? I 'm trying to make the Operator separate data set and put it in the first column and add a parameter in all quires i.e (where (operator = ?)) to get the Operator from the current row of operators column..But I can not attach the parameter value in each dataset to a the Operator dataset data set. Is this strategy right ? If yes .. how can I do that. If no, what is the correct strategy? Million thanks in advance,

A: 

You can certainly create as many data sets on a BIRT report as you need. From there you can create joint data sets that create a unified view of the data. DO you have a common field amongst your data sets that can allow you to create the join?

If you cannot create the joint data set, I would recommend setting up a scripted data set. The scripted set relies on a POJO to aggregate the data and apply the business logic necessary to produce the unified view you need. From there you read the data into the report from the POJO and you are all set.

MystikSpiral
Thx mystikspiralI have many data sets already Expr1 Expr2 Expr3 where all have a common column which is Operator.How can I join 10 data sets wherever I found each joint data set is joining 2 datasets.and what about the idea of making all data sets parametrized on the value of the common data set column ?
Montaro
Hint ... all the quires from ONE table
Montaro
You can parameterize any query by placing a ? in the query text and then looking at the Parameters section of the data set editor to bind the parameter to the query.
MystikSpiral
I can not do it in the other Data set like where (OperatorName = ?)
Montaro
I added in the query where (OperatorName = ?) but how can I link this parameter with the OperatorsName dataset column value .. I can only attach to report parameters??
Montaro
You cannot link it with anything other than a report parameter. You can modify the query text in one of the scripting events (onOpen should work). You can do any string manipulation you want there against this.querytext. Any changes to that prior to the data set getting built will cause the query getting executed to change. Try adding the value you need to substitute for into a global persistent variable. You can access that anywhere in the report. You may need to set up a data set just to look that value up, but that gets beyond the scope of this question.
MystikSpiral
I think the parameterisation of Operator is a red herring here. It's needed in report designers such as Crystal or SSRS to create subreports, but not when creating joint datasets in BIRT.
Mark Bannister
A: 

If your multiple datasets are coming from the same datasource, I recommend combining the queries.

If the multiple datasets are coming from different datasources, you can link them together using the Joint Data Set functionality in BIRT.

To link two separate datasets together:

  1. Right-click on Data Sets in the Data Explorer pane within the BIRT Report Designer, and select New Joint Data Set.
  2. On the New Joint Data Set dialog, select the data set and field (Operator, here) to be joined from on the left-hand list.
  3. Select the join type (Inner, Left Outer, Right Outer, Full Outer) from the options between the two lists.
  4. Select the data set and field (Operator again, here) to be joined to on the right-hand list.
  5. Give the resultant new dataset a meaningful name, in the option at the bottom of the dialog.
  6. Click Finish.
  7. Edit the resultant dataset to produce output as required, from the Edit Dataset dialog.

You can only produce joint datasets from no more than two existing datasets. However, joint datasets can themselves be included as input datasets for other joint datasets - so if you need to join three datasets together, this can be achieved by linking two of them into one joint dataset, then creating a new joint dataset based on the first joint dataset and the third original dataset.

It is not necessary to paramterise any of the existing queries to join datasets. A parameter condition on Operator in the query should only be included if the intention is to restrict the Operators returned in that dataset (eg. to return operators 100-121 only).

Mark Bannister