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)
How do I get result set to include data for an EndDate parameter?
cletehayes
<p>I have a simple report to allow users to see what has been billed to their account for a specific period of time. The user is prompted to enter a StartDate and an EndDate parameter.</p><p> </p><p>However my result set does not include transactions which occur <span class='bbc_underline'>on</span> the EndDate. It acts like (EndDate - 1). How do I get BIRT to <span class='bbc_underline'>include</span> EndDate transactions?</p><p> </p><p>Any advise would be appreciated. Clete</p>
Find more posts tagged with
Comments
Hans_vd
<p>What is your data source?</p><p>Do you use the enddate in a filter? In a script? Is it bound to a data set parameter?</p>
cletehayes
<p>Hans,</p><p> </p><p>The data source is Microsoft SQLserver. StartDate and EndDate are dataset parameters bound to corresponding report parameters entered by the user.</p><p> </p><p>The WHERE clause in the dataset query is like:</p><p> </p><p><strong><em>WHERE table.billing_date >= ? AND table.billing_date <= ?</em></strong></p><p> </p><p>The first ? is StartDate and the second is EndDate</p>
micajblock
<p>I am guessing that your billing_date is a date time data type. So if you enter only a date it will midnight the morning of end date.</p>
cletehayes
<p>The billing_date is datetime data type, but I can't figure out how to force BIRT to let me manipulate the variable before the query SELECT statement. ?</p>
micajblock
<p>Easiest I would think would be to add a day and subtract a second.</p>
cletehayes
Yes, I agree, but I can't figure out where exactly to do that.
micajblock
<p>in the beforeFactory of the report, something like this:</p><pre class="_prettyXprint">params["End Date"].value = BirtDateTime.addSecond(BirtDateTime.addDay(params["End Date"].value,1),-1);</pre><p>or even better set the default value of the parameter. See screenshot.</p>
cletehayes
I used your second suggestion and changed the default value of the parameter. It worked and gave me the results I needed.
Thank you so much for taking the time to show this newbie a new trick. I would never have thought of that.
Thanks again.
Clete
bgbaird
<p>One of the tools I use quite often is a set of date selection parameters:
Custom Range, Last Week, This Month, and so on.
I'm attaching a demo, just drop "resolveDates.js" in your resources/JavaScripts folder, or put the function directly in the initialize script on the report design.</p><p> </p><p>Here is a link to my FTP since I still can't figure out how to attach files. I'll keep the link active for a few weeks.</p><p> </p><p><a data-ipb='nomediaparse' href='
https://file.ac/3c3V4mA8JOY/'>https://file.ac/3c3V4mA8JOY/</a>
;
Brian</p>
bgbaird
<p>Here is my example.</p><p> </p><p>