cancel
Showing results for 
Search instead for 
Did you mean: 

Default Prompt Value

Former Member
0 Kudos

Hi,

We have a requirement to pass previous month to the report if the user does not select any value in the prompt. Meaning the value needs to default with no selection but if there is selection then the value selected should be passed. We have Reporting month(string) in yyyy/mm format. Another problem is the month value displayed in the report is based on the reporting month selected. So If the value entered is null the report output doesnot display any data.

I tried using dynamic prompt by bringing getdate() as a separate query but the problem is it just defaults to the previous month and doesnt allow to any other as input.

Please let me know what you think I need to do.

Thanks,

Karthik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you are using a static string parameter for months then edit the parameter and in parameter options use default value as "Last Month". Now use the record selection like this

if {?Parameter}="Last Month" then

{month field}= month(currentdate)-1

else

{month field}={?Parameter}

if you are using numeric parameter then use default value 0 and use the same record selection but replace "Last Month" with 0.

Regards,

Raghavendra

Former Member
0 Kudos

Hi Raghavendra,

Thanks for the reply. The parameter is not created at the report level but in the command level. If the "Last Month" value is set as default value, then the query that runs against the database returns no data and so nothing displays in the report. Not sure if I'm doing some mistake.

Please let me know.

Thanks,

Karthik

Former Member
0 Kudos

remove the command level parameter and use report level parameter. Are you using stored procedure? or just a query? If it is a query then remove the parameter and create in crystal report and use the record selection as mentioned before.

Regards,

Raghavendra

Former Member
0 Kudos

Thanks. I'm trying with both Stored Proc and query but the problem is I need YTD data to show in the report ... meaning, If user select feb 2008, I need to show data from oct 2007 to feb 2008. With that YTD, I need to Current month data which is feb 2008.

Is it possible to do this logic in selection formula together with the previous month logic? I created the parameter in the command to get this logic working.

Please let me know.

thanks,

Karthik

Former Member
0 Kudos

You can use this in record selection

in YearToDate

Regards,

Raghavendra

Answers (0)