1
votes

An SSRS report has multiple parameters, each using it's own stored procedure and dataset. The user first selects a school district from a drop down list. From there, a second drop down populates with the schools in that district.

Once the user picks a school, a third drop down populates with a list of certification dates from which the user can select one. All the queries and drop downs populate correctly.

How to display the most recent date instead of the <Select a Value>?

As an example, for school A, there are three dates from which the user can select one, the most recent being 07/30/2015. The query sorts the dates in Desc order so I want the first one be the default, not <Select a Value>. Rather than go into all the things I've tried, how can this be done?

2
Looks like you're missing a couple pieces of information from your question. The last sentence in your first paragraph -- "instead of the..." what? And in the second paragraph, "I want the first one be the default, not..." what? Do you have a default set on your parameter? If so, what's it set to?molleyc

2 Answers

1
votes

I usually have a separate dataset for the parameter query and add a MAX column with a subquery to find the latest date.

SELECT DISTINCT CONVERT(VARCHAR(10), checkprintdate, 101) AS CHECK_DATE,
        (SELECT CONVERT(VARCHAR(10), MAX(checkprintdate), 101) AS X1
            FROM paycheck AS P2) AS MAX_CHECK_DATE
FROM paycheck
ORDER BY CHECK_DATE DESC

I use the CheckDate as the Value and the MaxCheckDate as the Default.

0
votes

The 'Select a value' (sorry about the missing piece, I didn't realize it wouldn't display with the <>) was the text that was actually showing up in the drop down box, rather than 'ALL' or an empty box. The user should be allowed to select any of the three dates, not just the latest (so I couldn't use the MAX() in the query). But, in any case, I changed the Default values (in the Report Parameter Properties box) on the CertificationDate parameter from 'Specify values' to 'Get values from a query', then put in the dataset name and the field name for the 'Value field'. The most recent date now displays in the drop down box (without the user having to click the down arrow and click on the value). Thanks for the responses.