Reporting: TextBox.DataField does not do lazy evaluation, any work-around?
Hi! Everybody,
I am using Geocortex Report Designer 2.21.0.189 to create report templates to work with GeoCorex Essential 4.1 workflow. Following the documentation in
https://support.geocortex.com/using-field-expressions-in-the-geocortex-report-designer
I could use C#-like expressions in TextBox.DataField properties.
To handle the data with null values, an expression like
=(FieldName == System.DBNull.Value) ? "N/A" : FieldName
works properly by displaying "N/A" for null values, and the actual number for non-null value.
However, when I tried expressions like
- =(FieldName == System.DBNull.Value) ? "N/A" : (double)FieldName
- =(FieldName == System.DBNull.Value) ? "N/A" : ((double)FieldName * 0.1)
- =(FieldName == System.DBNull.Value) ? "N/A" : (FieldName.ToString())
- =(FieldName == System.DBNull.Value) ? "N/A" : (Double.Parse(FieldName.ToString()) * 0.1)
"Control Script failed" error messages are displayed on the report for the records with null value, and the correct numbers are calculated for records with non-null values.
Based on the test result, the TextBox.DataField property doesn't seem to do lazy evaluation like C# on the expression, and will attempt to evaluate the logical branch that is not going to be reach for a record, then throws error for the value invalid for the branch. This seems limits the flexibility of adding logics into the report a lot.
I understand that there is still some work-around to generate the reports I want, such as moving the logic to Geocortex workflow or writing some script function in the template. Besides these I still wondering:
- Is there a way to use lazy evaluation in TextBox.DataField?
- Other ways to implemnt logic of handing a field value that may be null?
- Will GC reporting be imporved on this?
Thank you!
Sui
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
0 Kommentare