ComponentOne VSView Reporting Edition
Evaluate Method

Evaluates a VBScript expression in the current report context.

Syntax

[form!]VSReport.Evaluate (Expression As String)

Remarks

Use this method to evaluate expressions as they would be evaluated while generating a report. This can be useful in designer-type applications, to provide an "Immediate Window" where users can test expressions to make sure they are correct.

The Expression parameter contains a string with VBScript instructions to be evaluated by the control. For example:

? vsr.Evaluate("2+2")

 4

? vsr.Evaluate(" ""A"" & ""B"" ")

 AB

In addition to the standard VBScript instructions, you have access to the Report object (the control) and all its sub-objects. For example:

? vsr.Evaluate("Report.DataSource.RecordSource")

 SELECT DISTINCTROW Categories.CategoryName, Categories.Description, Categories.Picture, ...

 

? vsr.Evaluate("Report.DataSource.Recordset.Fields.Count")

 7

 

? vsr.Evaluate("Report.Fields(0).Name")

 Line106

 

? vsr.Evaluate("Report.Fields(0).BackColor")

 16777215

Finally, to simplify the syntax of the expressions, all report field objects and recordset fields can be referenced directly by name. For example:

? vsr.Evaluate("Report.Fields(""Line106"").BackColor")

 16777215

 

? vsr.Evaluate("Line106.BackColor")

 16777215

 

? vsr.Evaluate("CategoryName")

 Beverages

If the Expression string contains invalid syntax or causes an evaluation error, the control raises an error.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback