Is it possible to add a multivalued parameter to a report from C#? I already have a C# .dll which I reference in the report. If so, could someone give some hints on how to do it?
As I searched the net for an answer to this, I came across ReportExecutionService. It looks like it's what I want, but I cant find the dll to reference in order to used this class. Does anyone know?
If it is not possible to do this from C#, then can someone please give an example on how to do it from Custom Code?
Thanks
/Peter
Hi,
The book SQL Reporting Services Step by Step Microsoft gave me most of my help,
Although, I'm trying to do a similar thing & am having a similar problem
I have a stored procedure which takes an array of values from the parameter list, but I want to process the value when the user clicks view report using the calculated parameter value not the actual parameter itself.
Code Snippet
CREATE PROCEDURE [dbo].[AStoredProc]
@.ArrayofValues ntext
AS
DECLARE @.DocHandle int
EXEC sp_xml_preparedocument @.DocHandle OUTPUT, @.ArrayofValues
SELECT
ColumnA, ColumnB
FROM
TableA
WHERE
ColumnA IN ( SELECT x.AnItem FROM OPENXML (@.DocHandle,N'/Root/SelectedItems,1)
WITH ( AnItem nvarchar(31)
) as x )
If I feed the parameter directly with XML eg.
In my custom code : The intention is to pass the array values via the parameter of a multi selected list which I've populated from a seperate query
eg so I have values AValue1 to AValuen in the list and I select from human readable form the parameter.
In my custom c# assembly I've created a public static function...
Code Snippet
public static string ConvertMultiParametersToXml(string ArrayofItems){
string retval = "";
const string rootNode = "Root";
const string ItemList = "SelectedItems";
const string Items= "AnItem";
XmlDocument xmlDoc = new XmlDocument();
XmlElement rootElement = xmlDoc.CreateElement(rootNode);
xmlDoc.AppendChild(rootElement);
string[] TheItemArray = ArrayofItems.Split(',');
for (int i = 0; i < TheItemArray .Length; i++)
{
XmlElement procElement = xmlDoc.CreateElement(ItemList);
procElement.SetAttribute(Items, TheItemArray [i].ToString());
rootElement.AppendChild(procElement);
// ProcArray[i]
}
retval = xmlDoc.InnerXml.ToString();
return retval;
}
Then after adding a reference, and inserting into a table I call
Code Snippet
=.ConvertMultiParametersToXml(Fields!ColumnA.Value)but I get a dom error because when the report is processesed it uses the parameter value rather than the calculated value when processing the dataset.
Is there a way to stop the redirect the parameter value via code on the initial processing?
Kind Regards
Rich
No comments:
Post a Comment