An attempt was made to set a report parameter

  • I've done so many google searches and have come to no success.

    Where I work, we use some garbage called ENVOX Studio where our customers call in through telephone, and ENVOX uses some stored procedures from our SLQ Database. They have some RSS junk setup written in VBScript and the error logs keep showing the following when attempt to generate one of our Reporting Services reports:

    An attempt was made to set a report parameter 'Treatment' that is not defined in this report.

    All the code in the script works fine except for the additions I made, not sure why it's not working.

    Dim ReportDir as string = "C:\Reporting Services\"

    Public Sub Main()

    ' I CHANGED (2) TO (3) SINCE I ADDED A NEW PARAMETER BELOW

    Dim parameters(3) As ParameterValue

    parameters(0) = New ParameterValue()

    parameters(0).Name = "Site"

    parameters(0).Value = Site

    parameters(1) = New ParameterValue()

    parameters(1).Name = "Patient"

    parameters(1).Value = Patient

    parameters(2) = New ParameterValue()

    parameters(2).Name = "RefaxFlag"

    parameters(2).Value = RefaxFlag

    'THIS IS THE CODE I ADDED

    parameters(3) = New ParameterValue()

    parameters(3).Name = "Treatment"

    parameters(3).Value = Treatment

    My SQL SP code that executes the report is:

    SET @CommandString =

    'rs -i '

    + char (34)

    + 'C:\Reporting Services\P2003\Randomization.rss'

    + char (34)

    + ' -s http://localhost/reportserver'

    + ' -v Site='

    + @Site

    + ' -v Patient='

    + @Patient

    + ' -v RefaxFlag='

    + @RefaxCall

    + ' -v Treatment='

    + cast(@Treatment as varchar(1))

    + ' -e Exec2005';

    My SP works just fine. Apparently it's the VBScript in that RSS file.

  • Did you modify the report? Or just the call?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • *sigh* this is why I hate taking over a project... I haven't the slightest clue on how to really answer your question.

    There's no actual report yet, it's just an RSS file that generates the report. Here's the entire RSS code:

    ' Randomization.rss for P2003

    Dim ReportDir as string = "C:\Reporting Services\"

    Public Sub Main()

    Dim parameters(3) As ParameterValue

    parameters(0) = New ParameterValue()

    parameters(0).Name = "Site"

    parameters(0).Value = Site

    parameters(1) = New ParameterValue()

    parameters(1).Name = "Patient"

    parameters(1).Value = Patient

    parameters(2) = New ParameterValue()

    parameters(2).Name = "RefaxFlag"

    parameters(2).Value = RefaxFlag

    parameters(3) = New ParameterValue()

    parameters(3).Name = "Treatment"

    parameters(3).Value = Treatment

    Dim CoverSheetPDF AS String

    Dim CoverSheetTIF AS String

    Dim RandLetterPDF AS String

    Dim RandLetterTIF AS String

    Dim StarterSheetPDF AS String

    Dim StarterSheetTIF AS String

    CoverSheetTIF = ReportDir + "P2003\Cover Sheet\" + Site + "-" + Patient + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + "CoverSheet.tiff"

    CoverSheetPDF = ReportDir + "P2003\Cover Sheet\" + Site + "-" + Patient + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + "CoverSheet.pdf"

    RandLetterTIF = ReportDir + "P2003\Randomization Letter\" + Site + "-" + Patient + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + "RandomizationLetter.tiff"

    RandLetterPDF = ReportDir + "P2003\Randomization Letter\" + Site + "-" + Patient + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + "RandomizationLetter.pdf"

    If (Treatment = 1) Then

    StarterSheetTIF = ReportDir + "P2003\Starter Sheet 1\" + Site + "-" + Patient + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + "StarterSheet.tiff"

    End If

    If (Treatment = 2) Then

    StarterSheetPDF = ReportDir + "P2003\Starter Sheet 2\" + Site + "-" + Patient + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + "StarterSheet.pdf"

    End If

    '

    ' The first parameter below (in the double quotes) is the path; this is from the name of the TargetReportFolder

    ' deployment parameter which is located in : Visual Studio (Project --> Properties). The popup (in Visual Studio) shows the Debug

    ' and Deployment parameters

    '

    GenerateReport("/P2003/Cover Sheet", parameters, "image", CoverSheetTIF)

    GenerateReport("/P2003/Cover Sheet", parameters, "pdf", CoverSheetPDF)

    GenerateReport("/P2003/Randomization Letter", parameters, "image", RandLetterTIF)

    GenerateReport("/P2003/Randomization Letter", parameters, "pdf", RandLetterPDF)

    GenerateReport("/P2003/Starter Sheet", parameters, "image", StarterSheetTIF)

    GenerateReport("/P2003/Starter Sheet", parameters, "pdf", StarterSheetPDF)

    Console.WriteLine(CoverSheetTIF)

    Console.WriteLine(CoverSheetPDF)

    Console.WriteLine(RandLetterTIF)

    Console.WriteLine(RandLetterPDF)

    Console.WriteLine(StarterSheetTIF)

    Console.WriteLine(StarterSheetPDF)

    End Sub

    Public Sub GenerateReport(ByVal ReportPath as string, ByVal Parameters() as ParameterValue, ByVal format as string, ByVal Path as string)

    Dim deviceInfo as string = Nothing

    Dim execHeader as New ExecutionHeader()

    Dim results() as Byte

    Dim streamIDs() as string = Nothing

    Dim encoding as string

    Dim warnings() AS Warning = Nothing

    rs.Credentials = System.Net.CredentialCache.DefaultCredentials

    Dim RandomizationDoc as ExecutionInfo = rs.LoadReport(ReportPath, Nothing)

    rs.SetExecutionParameters(Parameters, "en-us")

    rs.ExecutionHeaderValue = execHeader

    rs.ExecutionHeaderValue.ExecutionID = RandomizationDoc.ExecutionID

    results = rs.Render(format, deviceInfo, "", "", encoding, warnings, streamIDs)

    Dim stream As FileStream = File.OpenWrite(Path)

    stream.Write(results, 0, results.Length)

    stream.Close()

    End Sub

  • Remember this is RSS as in Reporting Services Script not RSS as in the web feed.

    Do you know the url to your reporting services server? I would have expected to see it in the code but it might be else where.

    Basically the script is calling reports that have been deployed to SSRS. These reports need modified to add the new parameter in.

  • Just saw the url was in your first post.

    So you seem to have 3 ssrs reports being called:

    http://localhost/reportserver/P2003/Cover Sheet

    http://localhost/reportserver/P2003/Randomization Letter

    http://localhost/reportserver/P2003/Starter Sheet

    These are what need to be modified to accept the treatment parameter.

  • Thanks for the insight. I'm going to take a stab at it.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply