Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate dynamicaly the default value of static parameter by a formula

Status
Not open for further replies.

ivilas21

Programmer
Feb 10, 2012
2
ES
Hi there,

i would like to give to a static parameter a default value from a function.

Specifically, i need to create a parameter, which by default contains the current date, so the user can *edit* the datetime, to for example, remove the time (leaving the date).
Is that possible?
I would like to express the default parameter value in a formula, like {!current_date}?

I've tried an alternative solution by creating a dynamic parameter from the query "select toString(datetime()) from table limit 1", which returns the current date as i want, but when launching the report, is not possible edit it...

some ideas?

thanks!
 
I don't think there is a way to use a formula for a default parameter value, but you could handle this through a combination of instructing the user with the prompt text and setting up a selection formula that accommodates your criteria.

For example, you could tell users that if they want to use the current date with no time, they should select a certain extreme value, e.g., date(9999,9,9,0,0,0) or if they want to use the currentdatetime, to select date(9999,9,9,9,9,9). Assuming this is a datetime parameter you would then set up your selection formula like this:

(
(
{?Datetime} = datetime(9999,9,9,0,0,0) and
date({table.datetime})=currentdate
) or
(
{?Datetime} = datetime(9999,9,9,9,9,9) and
{table.datetime} = currentdatetime
) or
{table.datetime} = {?Datetime}
)

These might not be the criteria you are looking for, but it is the method I am suggesting.

-LB
 
Thanks lbass! indeed, finally i've found a solution after your answer. The solution would be to select the date formatting from a dropdownlist ( a parameter) , but i also need the date to be editable, so i guess that with another parameter asking for the desired timestamp it will work.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top