VSView Reporting Edition Reference > VSReport Control > VSReport Methods > GetReportInfo Method |
Returns information from a report definition file.
[form!]VSReport.GetReportInfo FileName As String, Info As ReportInfoSettings, [ Index As Variant ]
Report definition files are XML files created by applications such as the Report Designer. You can write applications to create report definition files as well; the format is quite simple. The parameters for the GetReportInfo method are described below:
FileName As String
This parameter contains the full name of the XML report definition file.
Info As ReportInfoSettings
This parameter specifies the information you want to retrieve. Valid settings are:
Constant |
Value |
Description |
vsrRICount |
0 |
Returns the number of report definitions in the file. |
vsrRIName |
1 |
Returns the name of a report in the file. Use the Index parameter to specify which report. |
vsrRIList |
2 |
Returns a tab-separated list of all reports contained in the file. |
Index As Variant (optional)
This parameter is used when Info is set to 1 - vsrRIName, to specify which report to retrieve. The index should be between 0 and GetReportInfo(vsrRICount) - 1.
For example, the following code populates a ComboBox control with all the reports in a file:
' count how many reports are in the definition file
s = App.Path & DataFileName
iCnt = vsr.GetReportInfo(s, vsrRICount)
' populate list box
cmbReport.Clear
For i = 0 To iCnt - 1
cmbReport.AddItem vsr.GetReportInfo(s, vsrRIName, i)
Next
The following version is more efficient, because it only needs to go through the report definition file once:
' get a tab-separated list of the reports in the definition file
s = App.Path & DataFileName
sList = vsr.GetReportInfo(s, vsrRIList)
vList = Split(sList, vbTab)
' populate list box
cmbReport.Clear
For i = 0 To UBound(vList)
cmbReport.AddItem vList(i)
Next
Use the Load method to load a report from a report definition file.