Home
Analytics
report design in birt all-in-one; start and end date parameters for one field in dataset; have param
mrEvans
For starters I am using the birt all-in-one instance (BIRT version 2.5.2, Eclipse version 3.5.2).<br />
<br />
I am new to BIRT and have gone through a couple of tutorials. I have checked forums and have found some potential solutions that use the tag library which do no seem to translate to the all-in-one method of report design.<br />
<br />
So, the basic scenario is this: I have a database full of service requests. I want to check for same day status updates based on the service date. Management would like to check a month or more at a time. Here is a simplified version of the query for the result set:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
Select *
from serviceRequests s
inner join changeLog l
on (s.svcDate=l.changeDate and s.idNum=l.idNum)
where
s.status='canceled' and
l.oldValue='scheduled' and
l.newValue='canceled' and
s.svcDate>= ? and
s.svcDate<= ?;
</pre>
<br />
So, I created report params rp_startDate and rp_endDate and result set parms rsp_startDate and rsp_endDate (which I linked to the report params) but the input could not find the way to the dynamic links. I could not seem to find any way to explicitly bind the result set params. <br />
<br />
I tried calling them out in the query itself (e.g. params["rsp_endDate"].value) without success.<br />
<br />
I tried taking the s.svcDate where statements out of the query and used report parameters to filter the s.svcDate variable at the data set level. However, this seems to bog the query down significantly. <br />
<br />
I am guessing in the interest of optimization it would be best if the values could be included in the query in a where statement.<br />
<br />
I would prefer to collect the parameters separately rather than a more complex delimited field to keep it simple for end users.<br />
<br />
What is the best way to tackle the problem?
Find more posts tagged with
Comments
fwhorton
For clarity, are you trying to display the service request for a month broken out by days?
mwilliams
Hi mrEvans,
When you put a '?' in your query, the birt dataSet editor automatically creates a dataSet parameter for this '?'. In your dataSet editor, you'll find these in the parameters section. When you click to edit one, the type should already be the correct type, i.e. integer, string, etc. In the Linked to box, you should be able to select the report parameter that you created external to the dataSet editor. If you have not yet created these parameters, you can create them from the editor by clicking on the expression button next to the linked to drop down. This will use the parameters in your SQL. This is the earliest that this can be done. If I'm misunderstanding something, let me know.
thuston
To link report parameters and query (?) parameters, go to the DataSet and select Parameters.
You will see 2 params (one for each ?). On the far right/bottom(edit) is 'Link to Report Parameter', select existing report param from the dropdown or make a new one by pressing the expression button.
mrEvans
<blockquote class='ipsBlockquote' data-author="'fwhorton'" data-cid="68716" data-time="1285271545" data-date="23 September 2010 - 12:52 PM"><p>
For clarity, are you trying to display the service request for a month broken out by days?<br /></p></blockquote>
<br />
I was leaving out the grouping details because I didn't want to distract from the issue i was trying to describe. I will be grouping on year, month, status, and service date and including aggregated footers for each.
mrEvans
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="68717" data-time="1285271766" data-date="23 September 2010 - 12:56 PM"><p>
Hi mrEvans,<br />
<br />
When you put a '?' in your query, the birt dataSet editor automatically creates a dataSet parameter for this '?'. In your dataSet editor, you'll find these in the parameters section. When you click to edit one, the type should already be the correct type, i.e. integer, string, etc. In the Linked to box, you should be able to select the report parameter that you created external to the dataSet editor. If you have not yet created these parameters, you can create them from the editor by clicking on the expression button next to the linked to drop down. This will use the parameters in your SQL. This is the earliest that this can be done. If I'm misunderstanding something, let me know.
<br /></p></blockquote>
<br />
I had manually created the data set parameters and linked them to the report parameters before specifying the dynamic link parameter in the query. I think this may have been the issue as it is unsure of which maps to which?<br />
<br />
Deleting the parameters and creating new ones using the default names param_1 and param_2 seemed to fix the issue.<br />
<br />
Thanks for the help!
mrEvans
<blockquote class='ipsBlockquote' data-author="'thuston'" data-cid="68721" data-time="1285273007" data-date="23 September 2010 - 01:16 PM"><p>
To link report parameters and query (?) parameters, go to the DataSet and select Parameters.<br />
You will see 2 params (one for each ?). On the far right/bottom(edit) is 'Link to Report Parameter', select existing report param from the dropdown or make a new one by pressing the expression button.<br /></p></blockquote>
<br />
As mentioned in the original post I had linked the two parameter sets. My question regarding linking was if I could manually specify a link between a data set parameter and a dynamic parameter in the query which generates the result set.
mwilliams
Glad everything is working now! Let us know whenever you have questions!
thuston
The query used for dynamic parameter values should be a separate DataSet query. Otherwise you make a circle.
mrEvans
<blockquote class='ipsBlockquote' data-author="'thuston'" data-cid="68768" data-time="1285339033" data-date="24 September 2010 - 07:37 AM"><p>
The query used for dynamic parameter values should be a separate DataSet query. Otherwise you make a circle.<br /></p></blockquote>
<br />
Could you explain this statement? <br />
<br />
Separate from what? <br />
<br />
Do you mean have a static subquery and use the dynamic links in the main query? <br />
<br />
Or if you meant I should have two data sets... Why would I want to create two datasets? We are talking hundreds of thousands of records(millions in the case of the change log) here. I want to keep this efficient. <br />
<br />
If creating a temporary dataset would be more efficient I am all for it btw. In this use case the report will generally be ran once monthly. Although I am sure there are some audit/analysis situations where a year or more would be pulled. The use case may factor in to the usefulness of a temporary dataset so I figured I would mention it.<br />
<br />
Could you provide some sort of description of the flow of information to better describe this circle? <br />
<br />
In this scenario I had one query, one set of data set params, and one set of report params. <br />
<br />
To re-state the details of the scenario for the sake of clarity:<br />
---<br />
Initially I had started with a static select query to make sure I was pulling the basic data I wanted. After making sure that checked out I created report params and data set params (which I linked to the report params) and placed dynamic parameter placeholders (the ?'s) in the query. <br />
<br />
From what I can tell based on this experience I needed to 1. create the dynamic parameter placeholders before I created the dataset parameters; and, 2. use the default naming convention. Seemingly by doing so I allowed the dynamic links and data set params to invisibly bind in some way.<br />
---<br />
<br />
As I mentioned before I am new to BIRT. I have a couple days of experience with it. I would like to design these reports using best practices. I appreciate any help members of the community are willing to provide and am open to suggestions. <br />
<br />
Your comment was vague enough that, with my lack of experience with BIRT, I need you to make some clarifying points so that I can fully understand it.
mrEvans
<blockquote class='ipsBlockquote' data-author="'thuston'" data-cid="68768" data-time="1285339033" data-date="24 September 2010 - 07:37 AM"><p>
The query used for dynamic parameter values should be a separate DataSet query. Otherwise you make a circle.<br /></p></blockquote>
<br />
Or maybe you just meant... <br />
<br />
After I do my static query to check out the result set I should scrap that query and result set and start fresh? And, by doing so, avoid creating data set parameters which are not linked to dynamic parameter placeholders in the query.<br />
<br />
For the record: from now on I think I am just going to use the SQuirreL SQL client to test out the query results. That way I should be able to avoid this situation.
thuston
We may be describing different scenarios. I'll try to describe what I'm talking about and the flow.
GOAL: A parameterized query to be used in the report. When submitting the report for execution (running), the parameter dropdown should be dynamically populated with valid values from a DB table's field.
SOLUTION: 2 DataSets, 1 Report Parameter.
The first DataSet is a simple 'Select value, displayValue From Table'
The Report Parameter is configured to be dynamic based on the field(s) in the first DataSet.
The second DataSet is the full parameterized report query that will use the dynamic value from the Report Parameter.
FLOW:
1) The query linked for the Dynamic Report Parameter is run.
2) The parameter requester page is generated and dropdown populated (I think with only max 500 values, so this may help you limit the first DataSet)
2.5) Select a value and Finish to submit job
3) The chosen parameter value is passed to the report Engine
4) The report executes and the Table/Grid/etc causes the second query to run
thuston
If you only have one dataSet, I think step 1 will use the default value for the report parameter to run the query.
mrEvans
<blockquote class='ipsBlockquote' data-author="'thuston'" data-cid="68782" data-time="1285355418" data-date="24 September 2010 - 12:10 PM"><p>
We may be describing different scenarios. I'll try to describe what I'm talking about and the flow.<br />
<br />
GOAL: A parameterized query to be used in the report. When submitting the report for execution (running), the parameter dropdown should be dynamically populated with valid values from a DB table's field.<br />
<br />
SOLUTION: 2 DataSets, 1 Report Parameter.<br />
The first DataSet is a simple 'Select value, displayValue From Table'<br />
The Report Parameter is configured to be dynamic based on the field(s) in the first DataSet.<br />
The second DataSet is the full parameterized report query that will use the dynamic value from the Report Parameter.<br />
<br />
FLOW:<br />
1) The query linked for the Dynamic Report Parameter is run.<br />
2) The parameter requester page is generated and dropdown populated (I think with only max 500 values, so this may help you limit the first DataSet)<br />
2.5) Select a value and Finish to submit job<br />
3) The chosen parameter value is passed to the report Engine<br />
4) The report executes and the Table/Grid/etc causes the second query to run<br /></p></blockquote>
<br />
<br />
That would explain it. I am not trying generate a list of valid values in a list/combo box for the user to choose report parameters. Instead I am using text box to allow users to supply report parameters. It seemed reasonable that users could manually type in the dates. I am prompting them with the correct input format for the date. <br />
<br />
So, basically, they manually supply dates which get plugged into the query to specify the date range to check.<br />
<br />
Thanks for clarifying.