cancel
Showing results for 
Search instead for 
Did you mean: 

Parameters

Former Member
0 Kudos

Hello Experts,

I have a report where the date parameter is coming from command.

Now my requirements is I need to use 2 report level parameters Now and Schedule.

If I select Now then the report should ask the date parameter to enter which is coming from query .

If I select schedule the report should run for current date.

Please suggest how to do .

Accepted Solutions (1)

Accepted Solutions (1)

former_member205840
Active Contributor
0 Kudos

Hi Divya,

You have to incorporate Jamie suggestion in query. However, small change in the where clause :

({?WhenParameter} ='Now' AND Table.Date={?DateParameter}

OR

{?WhenParameter} ='Schedule' AND Table.Date=getdate())

Because when you select Now then it should take date parameter value other wise it should run for current date.

Note : when you run report it will ask for the use to input date parameter value also, but based on second parameter it will fetch the results.

-Sastry

Former Member
0 Kudos

Hi Sastry,

Please have a look at my requirement.

I need to show a parameter When containing values Now and Schedule.

If I select Now then I need to run my report for the date whatever the user selects from calender.

If I select schedule the report should run for current date.

So as you suggested I created a query level parameter date and When.

But when I run the report by default date prompt is also showing.So for that we need to enter some value.

But I need to run my report for current date if I selects Schedule from drop down list.

But now every time the date parameter is coming .What date value I have to enter if I selects Schedule for when parameter

Please suggest.below is the parameter window

abhilash_kumar
Active Contributor
0 Kudos

Hi Divya,

The Date prompt will always appear and you'd always need to select a date from the Calendar no matter what you choose in the 'Now' prompt. If you select 'Schedule', the query will automatically ignore the date chosen in the calendar and runs for the current date.

You may also set a Default Value for the Date Prompt if you don't want the user's to choose a date from the Calendar each time the report is run.

-Abhilash

former_member205840
Active Contributor
0 Kudos

Hi Divya,

Is it must to have date parameter at query level ?  If not,  create When & Date parameters at report level.

Make Date parameter as optional

Now in Record selection give below formula :

If HasValues({?Date}) and {?When}= "Now" Then

     {?date} = {DatabaseDate}

Else

     {?date} = Currentdate

Now if use does not enter date then it will run for Schedule and current date, if he selects date then it will run for that date for 'Now'

---------

If you want to have date parameter at query (add command) level, then use earlier post where clause.  User has to enter value for date, it may consider or may not based on When Parameter.

-Sastry

Answers (1)

Answers (1)

JWiseman
Active Contributor
0 Kudos

hi Divya,

you can use syntax similar to the following in the WHERE clause. your syntax will vary depending on your database...

      WHERE 

     (`table`.`Date`= {?Date} AND '?When} = 'Schedule')

      OR

     (`table`.`Date`= GetDate() AND {?When} = 'Now')

note that in this command example, there is only one extra parameter...if the end user chooses Now for the ?When parameter, then the above uses the curent date but when when the end user chooses Schedule then the date field uses the data parameter.

-jamie