Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Parameters from flat file
mdu_gprabh
Hi,
Attached the draft calendar for an year with year, month and start date as attributes. This calendar will be different for each year. We have to implement in design to automate the execution of reports by picking the parameter for the particular start date from the flat file when executing on particular month and year.
Thanks,
Prabu G
Find more posts tagged with
Comments
mwilliams
Hi Prabu G,
What version of BIRT are you using, so I can open this in the correct version?
mdu_gprabh
Hi Michael,
The version of BIRT is 2.2.2
mwilliams
Prabu G,
Can you explain your issue in further detail? Are you wanting to grab a date from a flat file and use it in the query to cal in the correct data? Is this what you're trying to do? If something else, let me know.
mdu_gprabh
Hi Michael,
Yes. I have to get a date from flat file and use it in the query. I am using the IOD as a source for my data.
Thanks,
Prabu G
mwilliams
What determines the date chosen from the flat file? The current day?
mdu_gprabh
The current month and year
Thanks
Prabu G
mwilliams
Prabu G,
Ok, I set up an example with the sample database that may help you out. What I do is bring in the flat file as a dataSet. I then drag the dataSet out to be a table in the report. You can then either filter the dataSet to only get the line for the current month and year, or you can filter the table like I did in this example. I grouped by the month so that I had a group header to show above the table. You could easily just use the standard header for this as well since you're filtering down to only one line.
Next, you merge the detail row cells together and put a table in there attached to your SQL query. In the binding tab for the inner table, you can click on the dataSet parameter binding button and set the value for the parameters in accordance with the "startDate" value from the outer table. In my example, I also set and end date to end at the end of the given year. Let me know if you have any questions on this.
mdu_gprabh
Hi Michael,
Thank you very much.
I have made some changes to the report design as per my requirement. Attached for your reference The user will be entering data for the Parameter["parm2"] in the revised design. If data is not entered for the parameter ["parm2"], then it is coded in the beforeopen() of dataset1 to pick up the default value. The code is given below.
if (params["parm2"].value ==null)
{
if (((new Date().getMonth()+1)==12) && ((new Date().getYear()+1900)== 2009))
{
params["parm2"].value= '03/01/2004';
}
}
I have currently hardcoded 12, 2009 and '03/02/2004' in the above code of beforeOpen() in dataset1.
I have to implement to pick up the hardcoded value(12(month),2009(year),'03/02/2004'(startdate)) from the dataset, dataset1 created from the flat file.
Thanks,
Prabu G
mdu_gprabh
Missed the attachment
mwilliams
I think I'm a little confused now... You're not just wanting the current month and year to decide the start date? You want the user to have the option to specify a start date and if they choose nothing, then it defaults to the value from the flat file? Is this what you're wanting? If not, let me know.
mdu_gprabh
We want the user to have the option in the user defined parameter to specify a start date and if they choose nothing (i.e), blank or null,
then based on the current month and year it defaults to the start date value from flat file.
Thanks,
Prabu G
mwilliams
Prabu G,
Gotcha. If you create a table set up the way I showed in the sample report and one set up with the parameter chosen by the user, you could drop one of the tables from the report depending on whether the user entered a value or not.
mdu_gprabh
Thankyou Michael.
I already have 4 tables implemented in the report. If I have to take a duplicate then it will increase the count of table to 8. Please let me know if any way of comparing the parameter with the database field as below in the scripting part.
For Example :
if (params["parm2"].value ==null)
{
if (((new Date().getMonth()+1)==dataset1.month) && ((new Date().getYear()+1900)== dataset1.year))
{
params["parm2"].value= dataset1.startdate;
}
}
Thanks,
Prabu G
mwilliams
Prabu G,
The final report would only have the 4 tables though. The rest would be dropped, not hidden, so they wouldn't effect your performance. I'll see if I can find another way to switch between those. I'll let you know.