Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Passing Date Range Parameters
cletehayes
<p><span style="font-size:medium;">[font="calibri;"]I am very new to Birt and I’ve run into a problem which I have not seen addressed in any documentation or group discussion threads. I’m writing a report to pull the amount billed to an account within a date range specified by the user. A simplified Select statement is:[/font]</span></p><p> </p><p><span style="font-size:medium;">[font="calibri;"]SELECT “accountâ€, “bill_dateâ€, “bill_amount†FROM “some tableâ€[/font]</span></p><p><span style="font-size:medium;">[font="calibri;"]WHERE “account†= ? AND “bill_date†>= ? AND “bill_date†<= ?[/font]</span></p><p> </p><p><span style="font-size:medium;">[font="calibri;"]My problem is with the date range parameters. I have created report parameters and data set parameters of type Date (short format “MM/DD/YYâ€). So the user must type in the account number, start date, and end date. For example, 98765 (account), 07/08/13 (start date), 07/10/13 (end date).[/font]</span></p><p> </p><p><span style="font-size:medium;">[font="calibri;"]The report runs fine. But I only get results for dates 07/08 and 07/09. It does not include my end date of 07/10. I have tried using BirtDateTime.addDay(), but it throws an exception error in the Select statement.[/font]</span></p><p> </p><p><span style="font-size:medium;">[font="calibri;"]Is there an easy way to force Birt to include the end date that the user enters? Using <= does not work for me and I don’t want the end users to have to add an extra day to the parameter.[/font]</span></p><p><span style="font-size:medium;">[font="calibri;"]Is it better to just use the “account†= ? in the WHERE statement and then use a Data Set Filter like “bill_date†BETWEEN RP_Start_Date AND BirtDateTime.addDay(RP_End_Date, 1) to filter out the results I want? [/font]</span></p><p> </p><p><span style="font-size:medium;">[font="calibri;"]Any insight would be appreciated. Thanks.[/font]</span></p>
Find more posts tagged with
Comments
kclark
<p>Can you post your rptdesign for me to take a look at?</p>
cletehayes
<p>Attached is the rptdesign. In this version I have the start date parameter in the data set query and then filter the end date in the data set filter. It works, but it takes a while to run from inside the AiM software. </p><p> </p><p>What I would like is to be able to have the start date and end date both to be part of the data set query.</p>