Friday, February 24, 2012

Default values for datetime parameters

Hi all,

I have a report that needs a to-date and a from-date as input. I would like them to be set to today by default.

I have set the data type for both parameters to DateTime and the default value as "Non-queried" = Today()

This does fill in the dates with today, but I cannot change the value in the fields, until the report has been generated once. I just want the date to be equal to today since 90% of the time that is what my users wants to see - but I want to give the last 10% the chance to change the date without having to generate the report first.

The date-fields are locked until some of the other parameters are filled in... It makes no sense really.

Hope you can help me here :-D

-- Heidi, Denmark

I have the following report parameters set that generate default From & To dates as the previous months 1st & Last Day. Both Available Parameters & Default Parameters are set to "Non-Queried"

The third parameter (groupid) defaults to a Null value but user can choose from a list of valid values.

When I deploy this report, the user can change the From & To dates without first running the report.

I'll attach the parameters XML

<ReportParameters>

<ReportParameter Name="startdate">

<DataType>DateTime</DataType>

<DefaultValue>

<Values>

<Value>=dateadd("m",-1,dateadd("d",-day(today)+1,today))</Value>

</Values>

</DefaultValue>

<Prompt>Select From Date</Prompt>

</ReportParameter>

<ReportParameter Name="enddate">

<DataType>DateTime</DataType>

<DefaultValue>

<Values>

<Value>=dateadd("d",-day(today),today)</Value>

</Values>

</DefaultValue>

<Prompt>Select To Date</Prompt>

</ReportParameter>

<ReportParameter Name="groupid">

<DataType>String</DataType>

<Prompt>Select Hierarchy Group</Prompt>

<ValidValues>

<DataSetReference>

<DataSetName>H_Groups</DataSetName>

<ValueField>id</ValueField>

<LabelField>List</LabelField>

</DataSetReference>

</ValidValues>

</ReportParameter>

</ReportParameters>

Does this help at all?

|||

Hi,

I've tried setting the dates like you do, but that doesn't help me. The user still isn't able to change the date values.

I have 6 parameters:

"Product" e.g. Ham (character)

"Batch" e.g. 121434 (character)

"From date" (datetime)

"From time" 05:00 (character)

"To date" e.g. (datetime)

"To time" e.g. 11:30 (character)

I only have default values for the date fields. The user cannot change the date values until he has entered something in the other parameters. It is like the date fields are disabled somehow and the default date isn't even displayed to the user (the field is simply grey...)

I suspect that it is because I use built-in functions instead of data from a query (I've tried making an sql selecting today, but I cannot really get that to work - problems with the formatting) :-S

|||

Heidi Christiansen wrote:

I suspect that it is because I use built-in functions instead of data from a query (I've tried making an sql selecting today, but I cannot really get that to work - problems with the formatting) :-S

I'm using built-in functions as well, so I don't think that's it.

Try making your date parameters the first ones to be chosen. I think this fixes it for you, although I don't really understand why this should be the case. I suspect it would be "by design"

|||

LOL

That helped... strange design decisions....

Thank you for your help :-D

No comments:

Post a Comment