The feature enables you to add your own Custom Fields to a table or view based on valid SQL expressions. You can treat a Custom Field as a dummy field you added to the table and the value of the Custom Field is evaluated from the specified SQL expression. Once added, the field can be treated as a normal field and will appear in all generated pages. You can use Server Events and Client Scripts to manipulate the Custom Field to display any content you want.
How to Use
To add a Custom Field to a table/view, simply right click on any database table/view (in the database pane) or click Edit in the main menu, then select Add Custom Field, the following form will show:
The properties are as follows:
|Field Name||Field name of the Custom Field. Note that the field name cannot be the same as any fields/Custom Fields in the table/view|
|Caption||The caption of the Custom Field.|
|Expression||A valid SQL Expression based on existing fields.|
After entering above properties, click OK button to save. The Custom Field will show up in the Fields panel of the specific table/view.
To edit the Custom Field, right click the Custom Field and select Edit Custom Field.
To delete the Custom Field, right click the Custom Field and select Delete Custom Field.
Testing SQL Expression
Custom Field is just a subquery in the SELECT statement for the table, e.g.
SELECT *, (SQL Expression) AS CustomField FROM MyTable
The highlighted part is the Custom Field, it is a subquery inserted into the normal SELECT statement for the table. That is why the expression for the Custom Field must be a valid SQL Expression. To make sure your SQL expression is valid, you can test your expression in your database manager first by executing:
SELECT (SQL Expression) AS CustomField FROM MyTable
e.g. if database type is MySQL, you test:
SELECT (`UnitPrice`*`Quantity`*(1-`Discount`)) AS SubTotal FROM MyTable
If it works, your SQL expression is valid, then you can enter your SQL Expression (e.g. `UnitPrice`*`Quantity`*(1-`Discount`)) and CustomField (e.g. SubTotal) to create your Custom Field and use them as Expression and Field Name in the Add Custom Field dialog respectively.