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)
Select dynamic parameter or static one
rosscr
I am currently developing reports in Actuate 8 and am learning BIRT with the intention of converting reports to BIRT in the near future, In the meantime I have the need to create a report with a date parameter that can be selected once then dynamically update in reference to sysdate. The reason is so the report can be scheduled to run weekly without adusting the parameter each time. To establish this date I'm using -
"next_day(to_date(trunc(sysdate-3)), 'SATURDAY') as Week_Start" which works but I also want the same report to allow for a user to select a date that isn't the next saturday. Don't want to have to update two reports each time there's a change.
Is it possible to to select one or the other using a case statement? I've had no luck. Can I hard code a parameter value, say next_day(to_date(trunc(sysdate-3)), 'SATURDAY') = Week_Start and then somehow overide this with a user selection. Again no luck.
Case when paramvalue = 1
then next_day(to_date(trunc(sysdate-3)), 'SATURDAY')
else :Week_Start
end as Week_Start
Am javascript challenged but would be willing to try if that's the best solution.
This report is for Maximo, so the parameters are established on a request page and their values prompted for when the report is run. And am able to have a default value.
Find more posts tagged with
Comments
mwilliams
With BIRT, you can have a default value for a parameter but still allow the user to change the value. I believe in BIRT 2.5.x an expression builder was added to the default value to allow you to build a dynamic default value easily. Let me know if I'm understanding correctly.
rosscr
Thanks for the reply. The difficulty I'm having is trying to establish a computed date based on sysdate (which I can write into the code)and also allow for a standard date parameter to take precedence or sustitute for the computed date.
mwilliams
Well, one thing you could do would be to set a default value for a parameter to "today" or something generic to say you've got a value and the user doesn't have to enter one. If the value comes back as "today", it would mean the user didn't specify an alternate date, so you'd use the date that you calculate in your code. If it comes back as something other than "today", you'd use the value they put in as your value.
You'd use the beforeOpen script section in your dataSet that uses this parameter to decide which date to use and to edit your queryText with the decided where clause.
rosscr
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78731" data-time="1308342726" data-date="17 June 2011 - 01:32 PM"><p>
Well, one thing you could do would be to set a default value for a parameter to "today" or something generic to say you've got a value and the user doesn't have to enter one. If the value comes back as "today", it would mean the user didn't specify an alternate date, so you'd use the date that you calculate in your code. If it comes back as something other than "today", you'd use the value they put in as your value.<br />
<br />
You'd use the beforeOpen script section in your dataSet that uses this parameter to decide which date to use and to edit your queryText with the decided where clause.<br /></p></blockquote>
rosscr
Thanks again for the reply. I understand the concept, it's the syntax/mechanics I'm struggling with. Would a case statement work to decide which date to use? I'm going to try to implement your suggestion and hopefully it will become clear as I work through it. Is there a sample project in the Classic Cars database that would give me some insight into what's required?
mwilliams
What version of BIRT are you working with?
rosscr
I have BIRT 2.6.2 from an all in one download and Actuate BIRT Version 11 on a six month BIRT onDemand license
mwilliams
Take a look. The default value of the string text box is "sysdate". If a different date is entered, the date entered is ran, if not, the calculated date (new Date()) is used. Let me know if this isn't what you're wanting.
rosscr
What you are describing is what I want but I'm not seeing this reflected in the report you sent. I'm not getting any change in dates when i leave sysdate verses inputting another date
mwilliams
You have to keep in mind that this report uses the sample database, so if you put in a date, be sure to put one that is between Jan-2003 to May-2005. Those are the dates that the sample database uses.
rosscr
I'm sorry but I'm missing something (maybe its the part of my brain that would understand this). I imported the report to Actuate 11 and previewed it. I get the parameter field with Cancel and Finish buttons and sysdate displayed as default parameter. I select a date and get a filtering of the data but I can't tell what it's filtering on and where the parameter is establshed and what or if it using a computed date.
I've looked at the dataset and all I see is this simple query:
select *
from CLASSICMODELS.PAYMENTS
Is there something scripted that I'm missing? NEVERMIND I found it right were you said it would be
Thanks again for your help and patience.
mwilliams
Is everything working as expected now?
rosscr
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="78946" data-time="1308833713" data-date="23 June 2011 - 05:55 AM"><p>
Is everything working as expected now?<br /></p></blockquote>
<br />
<br />
I haven't had a chance to implement and I'm not entirely comfortable with scripting. I have some resources here to help so I believe I will be able to work through it. <br />
<br />
Thanks, Craig
mwilliams
Well, let me know if you need help with this! Good luck.
rosscr
I appreciate that and I will