The Error Provider provides notification to the user of a data entry error. It's non-intrusive as an icon appears next to the control or column where the error is located. When the mouse hovers over the icon, a tooltip appears showing the error description.
There are two types of Error Provider that you can attach to a data grid follows:
1. Row Error Provider - Contains list of expression to be evaluated to determine if the table row contains invalid entry. The expression will be evaluated when the grid's after update is fired.
2. Column Error Provider - Contains list of expression to be evaluated to determine if the table column contains invalid entry. The expression will be evaluated when the grid's after column update is fired
In this sample, we will examine how the contrainsts attached to the app Journal Entry v20.
Step-by-step instructions:
1. Open App Gallery
2. Goto the grid called TableGroup and look for the app named Journal Entry V20.
3. Goto TableCollections and select table BookJE where you want to implement the error provider.
4. Click Error Provider tab
5. Add Row Error Provider, if any. The error icon will be posted at the left most corner of the row. If you fill-up the ColumnName the error icon will be shown in that column.
6. Add Column Error Provider, if any.
7. Click Save.
Row Error Provider Data Definition
Column Name
|
Sample Value
|
Description
|
DatasetTableName
|
BookHeader
|
The dataset table name where the error will be posted. See TableCollection for the list of table names. In this case the error provider is impleted at BookJE (Journal Entreis) but the error will be posted at BookHeader (Document Header) data grid. See image below for the implementation of this error.
|
ColumnName
|
|
Column name where the error will be posted. You can leave this blank if you wish to post the error on the row itself.
|
ErrorExp
|
if({this.Debit.Sum} <> {this.Credit.Sum}, 'Debit <> Credit', '')
|
Error expression to be evaluated on whether the user entered valid or invalid entries. In this case, if the Debit <> Credit, the Book Header table will have mark for the current row.
|
Status
|
A
|
A=Active; I=InActive
|
Createdby, DateCreated, Modifiedby, DateModified
|
|
These columns are called audit trails. Their values are auto-generated. One who created or modified the app. It is assumed that the current user is the one who created or modified the record.
|
TableGuid
|
|
Part of primary key and also a child key of the parent table, TableCollection
|
SeqNo
|
|
Park of primay key and use also in sorting of records
|
Column Error Provider Data Definition
Column Name
|
Sample Value
|
Description
|
ColumnName
|
BankAccounttNo
|
The name of the column of the current table where the error will be posted. If the column is located from another table other than the current table then use the RowErrorProvider instead
|
ColumnErrorExpression
|
if({this.Debit.Value}+{this.Credit.Value} > 0 and '{this.SLType.Value}'='B' and {this.BankAccountNo.Length}=0 ,'BankAccountNo should not be left blank','')
|
Error expression to be evaluated on whether the user entered valid or invalid entries. This is evaluated after the grid's column update is fired. In this case, if the SLType ='B' the BankAccountNo should be filled-up.
|
Status
|
A
|
A=Active; I=InActive
|
Createdby, DateCreated, Modifiedby, DateModified
|
|
These columns are called audit trails. Their values are auto-generated. One who created or modified the app. It is assumed that the current user is the one who created or modified the record.
|
TableGUId
|
|
Part of primary key and also a child key of the parent table, TableCollection
|
SeqNo
|
|
Park of primay key and use also in sorting of records
|
Below is the actual implementation of the error provider stated above:
|