Passing DateTime SSRS parameters filters to SharePoint GetListItems CAML query issue
Hi I'm having some issues passing report parameters to a CAML query that's behind my reporting connecting to a SharePoint list. I have a parameter Date (datetime type). I used =Parameters!Date.Value in my query but by default <CalendarDate> takes the current date as default date and it returns the result for the current date i.e Todays Date. However if I used actual hardcoded dates like 2012-11-03T00:42:34Z the report works fine. So I'm not sure what I'm missing, My query is as follows <Query> <SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction> <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems"> <Parameters> <Parameter Name="listName"> <DefaultValue>Bookings</DefaultValue> </Parameter> <Parameter Name="query" Type="xml"> <DefaultValue> <Query> <Where> <DateRangesOverlap> <FieldRef Name="EventDate"/> <FieldRef Name="EndDate"/> <FieldRef Name="RecurrenceID"/> <Value Type="DateTime"> <Today/> </Value> </DateRangesOverlap> </Where> </Query> </DefaultValue> </Parameter> <Parameter Name="queryOptions" Type="xml"> <DefaultValue> <QueryOptions> <ExpandRecurrence>TRUE</ExpandRecurrence> <CalendarDate>=Parameters!Date.Value</CalendarDate> </QueryOptions> </DefaultValue> </Parameter> <Parameter Name="ViewFields" Type="xml"> <DefaultValue> <ViewFields> <FieldRef Name="Title" /> <FieldRef Name="EventDate" /> <FieldRef Name="EndDate" /> <FieldRef Name="Room" /> <FieldRef Name="Hosted_x0020_By" /> <FieldRef Name="External_x0020_Attendees" /> <FieldRef Name="Catering_x0020_Requirements" /> <FieldRef Name="Fixed_x0020_Facilities" /> <FieldRef Name="Other_x0020_Facilities" /> <FieldRef Name="Company" /> <FieldRef Name="Layout" /> </ViewFields> </DefaultValue> </Parameter> </Parameters> </Method> <ElementPath IgnoreNamespaces="True">*</ElementPath> </Query>
November 7th, 2012 12:31pm

Hi, Maybe a problem with DateTime format : it must be ISO8601 format . Look at here : http://clinthuijbers.wordpress.com/2011/07/14/ssrs-formatting-date-and-time/ NicoBzh
Free Windows Admin Tool Kit Click here and download it now
November 7th, 2012 12:50pm

Hi Nico Thanks. I already tried different formatting options as =CDate(Parameters!Date.Value).ToString("yyyy-MM-ddTHH:mm:ssZ") but still its not working, its jus returning results for current date, even if i dont put any value in <CalendarDate>. If i put <CalendarDate></CalendarDate> than it returns for the current day. i think somehow the parameter value is not at al getting passed in the query.
November 7th, 2012 12:59pm

Hi Ishan, Even i am facing the same issue, however in my case i need to pass the text parameter instead of datetime parameter. Please find below the CAML query that i am using to pass the SSRS Report parameters to the query <Parameter Name="query" Type="xml"> <DefaultValue> <Query> <Where> <Eq> <FieldRef Name="Region" /> <Value Type="Text">=CStr(Parameters!Region.Value)</Value> </Eq> </Where> </Query> </DefaultValue> </Parameter> I tried following variations, as referred in this post <Value Type="Text">=CStr(Parameters!Region.Value)</Value> <Value Type="Text">" & CStr(Parameters!Region.Value) & "</Value> <Value Type="Text">Parameters!Region.Value</Value> <Value Type="Text">=Parameters!Region.Value</Value> however none of them worked. Any suggestions on this would be highly appreciated Regards, Ketan Gandhi.
Free Windows Admin Tool Kit Click here and download it now
December 4th, 2012 5:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics