January 30, 2009 at 7:09 am
I'm developing a report for various tests on groups of products. Each test has a different start and end date. I wanted to dynamically change the default start and end date parameters for my report based on the users choice of a test to report on.
Parameter1 - GroupId, does not have a default value and available values are based on a query (ProductGroup dataset).
Parameter2 - I struggled with the settings for Parameter2 (i.e. StartDate & EndDate). First, I created a DefaultDates expression a StartDate and EndDate based on the GroupId selected for Parameter1. I set default values for my StartDate and EndDate from this expression. Unfortunately, it only worked after the first GroupId selection. If a user changed the GroupId selection, then the values for Parameter2 would not be refreshed. Initially, I "fixed" this problem by also setting the available values for StartDate and EndDate based on my DefaultDates expression. However, this restricted the user to my default dates and I wanted the user to have some flexibility to change the default dates.
April 23, 2009 at 7:36 am
Hi,
I experienced the same problem.
A partial solution is to make a third dataset in which you retrieve all available values (for your selected group id)
And set the available values of your start and stopdate to that redordset.
(leave the default setting like you initially did)
The default values are still not refreshed, but if you'll select another group-id and the selected value (dependant parameter) is not in the new range of available values it's reset to the first available value.
Below is an example of how to become the values
([dbo].[TB_Identity] is a table with only an integer with values from 1 to ...)
DECLARE @dateMin date, @dateMax date;
DECLARE @intDateDiff int;
SELECT @dateMin=MIN(dateCollectionTime), @dateMax=MAX(dateCollectionTime)
FROM PDW.TB_DB_FileUsage_Size WHERE nsDBName=@@nsDBName;
SELECT @intDateDiff=DATEDIFF(DD,@dateMin, @dateMax)
SELECT CONVERT(date,DATEADD(dd,intID-1,@dateMin)) as dateCollectionTime FROM [dbo].[TB_Identity]
WHERE intID <= (@intDateDiff+1)
So if someone knows how to refresh the default value, at least 2 persons are interested 😉
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply