Passing external values to subreport

Stimulsoft Reports.NET discussion
Post Reply
Rodrigo V. Lagos Eustáquio
Posts: 7
Joined: Mon May 17, 2010 11:58 pm
Location: Brazil

Passing external values to subreport

Post by Rodrigo V. Lagos Eustáquio »

Hi all,

I have a situation using ASP.NET that i need from the main routine send same value to subreport variable. Ex. variable Titulo as String = "each user session changes it". All code works fine, but i dont know to send this value in variable Titulo.

Main Code

Code: Select all

With Report
      Dim Titulo as String = "each user session changes it"

      .Load(pSessionUser.ServerPath + "../Reports/" + pWebFormSelected.Report + ".mrt")

      .Dictionary.Databases.Clear()
      .Dictionary.Databases.Add(New StiSqlDatabase("Connection", pConnReport))

      .ReportName = pWebFormSelected.Report

      If Not IsNothing(pDataSet) Then
        pDataSet.Tables(0).TableName = "DataSet"

        .Dictionary.DataSources.Clear()
        .RegData("DataSet", pDataSet)
        .Dictionary.Synchronize()
      End If

      .Compile()

      AddHandler .GetSubReport, AddressOf rep_GetSubReport

      .Render()

End With
SubReport Code

Code: Select all

  Private Sub rep_GetSubReport(ByVal sender As Object, ByVal e As StiGetSubReportEventArgs)
    Dim Report As New StiReport()

    With Report
      .LoadFromUrl("D:\TituloPortrait.mrt")
      .Compile()

      'Titulo do Relatorio
      Report("Titulo") = Variable Titulo that i sad above.   '<---- here
    End With

    e.Report = Report
  End Sub
All code to call report is in a Module, if i create global variable works fine, but if i a have two ou more users accessing at the same time, the variable receive the last value of user clicking.

Tnks for any help.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Passing external values to subreport

Post by Alex K. »

Hello,
rvleustaquio wrote:I have a situation using ASP.NET that i need from the main routine send same value to subreport variable. Ex. variable Titulo as String = "each user session changes it". All code works fine, but i dont know to send this value in variable Titulo.
To access to the value of variable, you may use this code:

Code: Select all

Dim Report As StiReport = New StiReport()
Report.Load("Variables.mrt")
Report.Compile()
'Set Variable
Report.Item("VariableName") = " Value "
'Get Variable
Dim Value As Object = Report.Item("VariableName")
Thank you.
Rodrigo V. Lagos Eustáquio
Posts: 7
Joined: Mon May 17, 2010 11:58 pm
Location: Brazil

Passing external values to subreport

Post by Rodrigo V. Lagos Eustáquio »

I solved, i founded another way.

Tnks for help.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Passing external values to subreport

Post by Alex K. »

Hello,

Let us know if you need any additional help.

Thank you.
Post Reply