I want to extract variables and values from a report iterating the StiReport.Dictionary.Variables collection.
This works fine if the variables are of type string etc. But how to get the values from a "List"-variable type which is populated using a Sql query?
This the code I use:
Code: Select all
Private Sub ExtractVariables(reportId As Long, reportParameters As List(Of ReportParameter))
Using report As New StiReport
Dim reportName As String = Nothing
Dim reportBuffer As Byte() = GetReportBuffer(reportId, reportName)
report.Load(reportBuffer)
For Each variable As StiVariable In report.Dictionary.Variables
If (variable.ReadOnly) Then 'Theres no use to return readonly variables
Continue For
End If
Dim param As ReportParameter = New ReportParameter()
param.Name = variable.Name
param.Type = variable.Type
If (variable.Type Is GetType(DateTime)) Then
param.Value = CType(variable.ValueObject, DateTime).ToString("dd-MM-yyyy")
Else
'' ***** TODO: Howto Test and Extract List-variableType ? ********
End If
param.Description = variable.Description
reportParameters.Add(param)
Next
End Using
End Sub
Greetings,
Johan