Home
Analytics
Parameters
rugaju
I am trying to run a report where a user can select parameters before running it. I tried creating a parameter data set and searching off that but I had no luck. Is there a way of doing that?
Find more posts tagged with
Comments
mwilliams
Hi rugaju,
What all did you do? Here are the steps for creating a dynamic parameter that is tied to another dataSet you use in your report to limit the data:
* Create a new dataSet for your dynamic report parameter. It'll have a simple query just selecting the field that you want to have a parameter of.
* Create a report parameter tied to the above dataSet. Choose the list type parameter from the drop down. Then, choose dynamic and select the field for the value.
* Create your dataSet you're going to use in the report with a where clause like: "where table.field = ?"
* Next, in the parameter section of your dataSet editor, fill out the info for the dataSet parameter and choose your report parameter as the linked parameter.
Then, create your report from the report dataSet and run the report. You should see the data limited to you report parameter selection.
Hope this helps. Let me know if you have questions.
rugaju
I had got to the part but it still is not pulling data into the report. When I view the data for my parameters in the "preview results " section, I am able to see the data. It is when I run the report and it asks me to select my parameters that I am unable to see the data (see the picture atatched)
mwilliams
rugaju,
So I can see exactly what you're doing, can you recreate your issue with the sample database? Let me know what version of BIRT you're using when you attach your report design.
rugaju
Sample database? Where would I find that?
mwilliams
rugaju,
If you're using the designer, you'd just go to create a new dataSource and choose the classic models sample database as the type. Then, you'd create a SQL dataSet off this source.
rugaju
mwilliams,
I have attached my rpt file.
mwilliams
rugaju,
Take a look at the changes I made to your report. I added the other dataSet I described above for the parameter to use as a source. Then, I limited the second dataSet's SQL based on this parameter so only the employees from the chosen office are shown in your table. Let me know if you have questions.
rugaju
Michael,
I was able to create the parameters with the sample database. However, it fails with the Maximo database(which is the database i am trying to report off of). I have searched in many places but U am unable to make any progress. Also, would you know how to prevent a graph from showing more than once for a grouped report?
mwilliams
rugaju,
You used another dataSet for the parameters and everything? Not trying to use the same one for parameter selection and for your table?
rugaju
I did use a different dataset. The issue maybe that they did some java hardcoding on the templates for tivoli/maximo that do not allow setting parameters from the report builder. There is also another issue that I have encountered. WHen i build a grouped report with a graph, i get a graph that repeats itself eachtime the grouping changes. I wanted only one graph but i do not know where to set this. I looked into the graph properties but so far, no luck.
mwilliams
rugaju,
If you're putting the graph in the group header/footer, it'll repeat each time there is a new group. You could hide the chart after the first group to keep from showing it each time. This can be done by changing the value of a variable when the first group is displayed and hide the chart from then on based on the new value of your variable.
rugaju
Where would I set the variable? I do not see it in the chart property editor.
mwilliams
You would just create a variable, say showChart = 0 in the initialize script of your report design. Then, in the group footer onCreate script, you'd put something like:
if (showChart == 0){
showChart = 1;
}
You'd then click on the chart and in the property editor, you'd use a visibility expression like:
if (showChart == 1){
true
}
else{
false
}
rugaju
Michael,
I know it has taken me a while to get to this point but I finally have. What I was trying to achieve is to parse a month and year as parameters in Tivoli. I had been doing it in my SQL and it failed (obviously since it says we should do this in the open method). My question is what syntax would I need to use to pass just the month and the year using java script?
mwilliams
rugaju,
You want to grab the month and year from a date parameter to pass through the SQL as parameters? Or something else? Are you wanting the month as its own parameter and the year as its own as well? Let me know.
rugaju
I would like the Month as its own parameter and the year as its own parameter. Does this help?
mwilliams
As their own parameters for the user to enter? And then you want to make a date out of the two value to pass through your SQL? Or, you want to take a single date from the user and pass the month and year separately through your SQL? Or something different? Let me know.
rugaju
Basically, i was hoping that the user could put in a month and year (each their own parameters) and have the report return data. If that is not possible, is it possible to select from a range of dates? If both are possible, please let me know what to do.
Thanks
David Rugaju
mwilliams
David,<br />
<br />
If you would like for the user to enter a month (int) and a year individually and make a date out of them, you could create the date in your dataSet's beforeOpen script to pass to your SQL like the following.<br />
<br />
Say the user enters a month value and year value that they want to see all data after.<br />
<br />
userDate = new Date(params["year"], params["month"], 1, 0, 0, 0); // this creates a date of the first of that month<br />
<br />
this.queryText = this.queryText + " where Date > '" + userDate + "'";<br />
<br />
Another thing you could do would be to implement the js calendar and allow the user to select the date/dates from the calendar.<br />
<br />
This devShare post may help you with that:<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/deploying-birt-reports/770-calendar-for-date-parameter-in-birt-viewer/#description'>Calendar
for date parameter in Birt Viewer - Designs & Code - BIRT Exchange</a>
rugaju
Mike,
Thank you for the links. I am still investigating which method will be best for my employers. I have a relatively easy question but i cannot figure out the answer. If i have a report with a field in it that is BINARY (Or true false.) How can I program it to show in the "Y/N" format in the report?
mwilliams
David,
You should be able to select the element in the report that has the binary field in it and go down to the property editor's map section and set up mappings to display Y/N.
dan3874
I am also having problems with the dynamic parameters. I followed your example of setting up a separate dataset from my offsite data source. I have two different issues: In one report I can get the dynamic data to show up to select from. However, if the selection is made from the drop down list it is not passed on to the output - so nothing shows up in the report. However, if I make the parameter a combo box, I can type in the same value that does not work with the selection, and it is passed to the report so I do have data. In the second report, I cannot get the dynamic data to show up at all. In this report if I make that parameter static I can attach the dataset parameter to it, but if I set it as dynamic, the dataset area does not recognize it.
I really need to figure out why this isn't working for me. Could it be something in my datasource setup? The database I am accessing is not on the computer I am writing the report from.
Any help is appreciated! Thank you, in advance.
mwilliams
dan3874,
Can you recreate your issue with the sample database? Or are you only getting your issue when you use your own database?