Navigation: Build Your Own ERP >

Constraints

 

 

 

Constraints are sets of rules that you can apply during data entry stage.They are usually evaluated when the grid's before edit is fired to refrain user from entering or editing the data. There are two types of contraints that you can attach to an app as follows:

1. Table Constraint - Contains list of contrainst to be applied against the table. The constraints will be evaluated when the grid's before edit or before addnew is fired.

2. Column Constraint - Contains list of contrainst to be applied against the table columns only. The constraints will be evaluated when the grid's before column edit 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 the table where you want to attach the contraints.

4. Click Contraints tab

5. Add table contraints, if any

6. Add column contraints, if any

7. Click Save.

 

NOTE: If you do not want the user to add new record or edit an existing the data at all times, you can set the grid's AllowAddNew and AllowEditing to False instead of creating constraints.

 

Data Definition for Table Constraint:

Column Name

Sample Value

Description

ConstraintExpression

if('{grid.BookHeader.Status}'='P', 'Record is already posted; request denied.','')

Constraint expression to be evaluated. This is evaluated on the grid's before edit event is fired to determine if editing will be allowed or not. If the returned value of the expression is empty that means it passes the criteria and the user is allowed to edit the data. Otherwise, a pop-up message will be shown informing the user of the a rule is violated. See the topics about Parser in creating your Constraint Expression.

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

Data Definition for Column Constraint: (The sample values are in another app, not shown in the photo above)

Column Name

Sample Value

Description

ColumnName

BouncedCheck

The name of the column where the constraints will be applied

ConstraintExpression

if('{this.CheckCleared}'='True', 'Check is cleared already.','')

Constraint expression to be evaluated. This is evaluated on the grid's before column edit event is fired to determine if editing will be allowed or not.
If the value of the column CheckCleared is Checked then the user is no longer allowed to mark the BouncedCheck as Checked. See the topics about Parser in creating your Constraint Expression.

Status

 

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

 

 

 

 


 


 

 

 

Copyright © 2021 Terasoft Corporation