The Column Default Value is used to automatically fill-up columns with default values. You can use aboslute value or expression as default values. Default values are only suggested values, the user may oweride their values if the column is not locked.
In this sample, we will examine the column default values for Journal Entry v20 for the table BookHeader with caption Document Header
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 BookHeader where you want to add the column hyperlink.
4. Click Column Expression tab
5. Under the Column Default Value data grid, add the column expressions. The Parser is used to evaluate the values.
6. Click Save.
Let's explain the above three column default values.
1. For the CoID, the Default Value of "@CoID" refers to the Global Variable @CoID with will be evaluated upon loading of the data grid. See Global Variable for more details.
2. GLDate, the DefaultValueExp is "if('{this.DocType}' <> 'CV', '@GetCurrentDate()', '{this.GLDate}')". This expression will be evaluated by the parser.
3. TrasactionDate, the DefaultValueExp is "GetCurrentDate()". The GetCurrentDate() is a Global Vairable and its value includes Date and Time.
What is the difference between DefaultValue, DefaultValueExp and FixedValueExp?
The DefaultValue is evaluated only once and it is upon loading of the grid. Therefore, the value remains constant throughout the duration of the app.
The DefaultValueExp is evaluated everttime a new record is added. The value may change depending on the expression used. Ex: GetGuid() this expression will always return a different value which can be used to serve as primary key to a table.
The FixedValueExp is the same as the DefaultValueExp. The difference betwen the two is that the FixedValueExp will overide any existing value of the cell while the DefaultValueExp does not.
Data Definition for Column Default Value
Column Name
|
Sample Value
|
Description
|
ColumnName
|
CoID
|
The column where the default value will be applied
|
DefaultValue
|
@CoID
|
The default value of the column. This can be an expression or absolute value which will be evaluated upon loading of the grid. The default value is inserted when a new record is added. The @CoID is a Global Varialbe which refers to the current Company ID.
|
DefaultValueExp
|
|
The default value of the column. This can be an expression or absolute value which will be evaluated everytime an update is made to a row. If the cell has a value already, it will not be replaced.
|
FixedValueExp
|
|
Similiar to DefaultValueExp above, but this will replace an existing value of the cell, if any.
|
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
|
|