C1.C1Report Namespace > C1Report Class > Evaluate Method : Evaluate(String) Method |
'Declaration Public Overloads Function Evaluate( _ ByVal expression As String _ ) As Object
public object Evaluate( string expression )
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.
If the expression string contains invalid syntax or causes an evaluation error, the control raises the C1Report.ReportError event. In this case, the Handled parameter of the event is set to true, so the exception is ignored by default.
Expressions may contain simple VBScript expressions such as:
Expressions may also contain references to the Report object and all its sub-objects. For example:
Finally, data fields, Field, and Section objects may be referenced directly by name.
Console.WriteLine(_c1r.Evaluate("2+2")); 4 Console.WriteLine(_c1r.Evaluate(" \"A\" & \"B\" "); AB
Console.WriteLine(_c1r.Evaluate("Report.DataSource.RecordSource")); SELECT * FROM Employees Console.WriteLine(_c1r.Evaluate("Report.DataSource.Recordset.Fields.Count")); 7 Console.WriteLine(_c1r.Evaluate("Report.Fields(0).Name")); FirstNameField
Console.WriteLine(_c1r.Evaluate("FirstNameField.Value")); Andrew Console.WriteLine(_c1r.Evaluate("CategoryName")); Beverages
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2