How to get List values from report StiVariable Type List

Stimulsoft Reports.WEB discussion
Post Reply
JBaas
Posts: 1
Joined: Tue Oct 21, 2014 1:55 pm

How to get List values from report StiVariable Type List

Post by JBaas »

Hi ,
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
Thnx
Greetings,
Johan
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to get List values from report StiVariable Type List

Post by HighAley »

Hello, Johan.

Please, try to use next code:

Code: Select all

If (variable.Type Is GetType(StringList)) Then
Thank you.
Post Reply