Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2010-12-22 : 01:31:54
|
| Question first. Does the code below get the report parameters values from the catalog table in the report server or the rdl file? I ask this because when I run the code below it returns 'yesterday' for my daterange parameter and this is how it was set by default when the report was created and deployed to the server. However if I change the value using report manager to say 'last week' and apply I see the value change in the catalog table under the parameters field however the code still returns 'yesterday'. Does anyone know how to get the current parameter setting from the catalog table?USE [VC]GO/****** Object: StoredProcedure [dbo].[DateRange_ReportParameter_RP] Script Date: 12/22/2010 16:51:10 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author: Steve Harlington-- Create date: <Create Date,,>-- Description: <Description,,>-- =============================================ALTER PROCEDURE [dbo].[DateRange_ReportParameter_RP]@Report nvarchar(255)ASSET NOCOUNT ONDeclare @Date as nvarchar (100)Declare @sql nvarchar(max)--Find all the reports, and thier parameters and thier default valuesSelect @sql=''Select @sql=@sql+ ';WITH XMLNAMESPACES (DEFAULT ''http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'',''http://schemas.microsoft.com/SQLServer/reporting/reportdesigner'' AS rd --ReportDefinition)SELECT NAME , PATH , x.value (''@Name'', ''VARCHAR(100)'') AS ReportParameterName --, x.value (''DataType[1]'', ''VARCHAR(100)'') AS DataType --, x.value (''AllowBlank[1]'', ''VARCHAR(50)'') AS AllowBlank --, x.value (''Prompt[1]'', ''VARCHAR(100)'') AS Prompt --, x.value (''Hidden[1]'', ''VARCHAR(100)'') AS Hidden , x.value (''data(DefaultValue/Values/Value)[1]'', ''VARCHAR(100)'') AS ValueFROM ( SELECT NAME , PATH ,CAST(CAST(content AS VARBINARY(MAX)) AS XML) AS ReportXML FROM ReportServer$XTRALIS_CYCLOPS.dbo.Catalog WHERE CONTENT IS NOT NULL AND TYPE = 2 ) ACROSS APPLY ReportXML.nodes(''/Report/ReportParameters/ReportParameter'') R(x)WHERE NAME = '''+@Report+'''--Use the where clause above to look for a specific reportORDER BY NAME'--Print (@sql)Create table #x([Name] nvarchar(100), [Path] nvarchar(255), [ReportParameterName] nvarchar(100), --[DataType] nvarchar(100), --[AllowBlank] nvarchar(100), --[Prompt] nvarchar(100), --[Hidden] nvarchar(100), [Value] nvarchar(100))Insert into #xExec(@sql)SET @Date = (Select [Value] As DateRangefrom #xWhere ReportParameterName = 'DateRange')Select * from #xDrop table #xExec dbo.Date_Range @DateRange = @DateSET NOCOUNT OFFRETURNName Path ReportParameterName ValueEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD VCGDBPath NULLEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD DBName VCEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD SiteName NULLEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD TransmitterType NULLEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD EventType NULLEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD DateRange YesterdayEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD TextColour NULLEvent Integrated Report AD /Integrated Reports/Event_Activity/Event Integrated Report AD BackgroundColour NULL |
|
|
|
|
|
|
|