views:

2061

answers:

2

Hi all,

I have some working reports that must be deployed on SSRS. One more customization that I want to be added is to automatically select the FromDate as today - 1 month, and ToDate as today.

Specifically, I want to replace the fragment bellow with a piece that accomplish the requirements above:

 <ReportParameter Name="FromDate">
  <DataType>String</DataType>
  <DefaultValue>
    <Values>
      <Value>[Date].&amp;[2008-09-26T00:00:00]</Value>
    </Values>
  </DefaultValue>
  <Prompt>From Date</Prompt>
  <ValidValues>
    <DataSetReference>
      <DataSetName>FromDate2</DataSetName>
      <ValueField>ParameterValue</ValueField>
      <LabelField>ParameterCaption</LabelField>
    </DataSetReference>
  </ValidValues>
</ReportParameter>
<ReportParameter Name="ToDate">
  <DataType>String</DataType>
  <Prompt>To Date</Prompt>
  <ValidValues>
    <DataSetReference>
      <DataSetName>ToDate</DataSetName>
      <ValueField>ParameterValue</ValueField>
      <LabelField>ParameterCaption</LabelField>
    </DataSetReference>
  </ValidValues>
</ReportParameter>

Thanks in advance.

+3  A: 
Sung Meister
MariusCC
@MariusCC: Answer is updated.
Sung Meister
+1  A: 

You actually cant use the TSQL Date formats you ahve to use the .net methods:

=Now()

=DATEADD("m", -1, now())
Glennular