User Defined Defaults


File-> Customisation Configuration -> User Defined Defaults



The idea of this function is to allow you to defined default field values. This can be useful when setting up new records be they Customers, Supplier, Items etc..  These User Defined Defaults can occur when a new record is 'Inserted' into the database or when an existing record is Updated.


This frees up the user to simply focus on specific fields when entering a new record or order etc.. thereby leaving Ostendo to manage the default field values defined for the organisation.


This feature avoids the need for defining Required Fields, Custom Triggers and Screen Data Scripts in order to force a field value.


There are four methods that control when a Default Field Value can be used:


    1. On Insert when Blank
    2. On Insert and Update when Blank
    3. On Insert Always
    4. On Insert and Update Always



Note:

    • When setting a default field value that requires validation, ensure the field value you define is correct in every way eg: Case Sensitivity, spelling etc..


    • When defining a 'From Clause' and 'Conditional Clause' that relate to more than one table, you must prefix each field name with the Table Name 

eg: JobHeader.SalesPerson



Hint:

When defining a User Defined Default with 'From and Conditional' Clauses it is suggested you first test your syntax in the Data Spreadsheet (General -> Data Spreadsheet) feature of Ostendo prior to implementing the default values rule.


eg: 

Select Jobheader.SalesPerson from JOBHEADER,CUSTOMERMASTER where JOBHEADER.CUSTOMER = CUSTOMERMASTER.CUSTOMER and CUSTOMERMASTER.CUSTOMERTYPE = 'Services' and JOBHEADER.JOBCATEGORY = 'Plumbing' 


Fields:

    • Table Name: Drop Down and select the Table Name of the Field you wish to define the Default Value against
    • Field Name: Drop Down and select the Field Name of the Field you wish to define the Default Value against
    • Default When:
      • On Insert When Blank: This rule will run only when the Field Name (defined above) is left Blank on the screen when adding a new record
      • On Insert and Update: When Blank: This rule will run only when the Field Name (defined above) is left Blank on the screen when either adding or updating a record
      • On Insert Always: This rule will always run when the Field Name (defined above) is either blank or has an entry in it only when adding a new record
      • On Insert and Update Always: This rule will always run when the Field Name (defined above) is either blank or has an entry in it when either adding or updating a record


    • Default Field Value: This maybe a Literal value (ie: Free-form text or a Field Value).
      • NB: When this is a Literal Value, care must be taken if this Value is a validated entry. eg: Jane Steel, not jane Steel
      • If a Field Value is to be used, simply enclosed the field with square brackets eg: [CUSTOMERMASTER.SALESPERSON]
    • From Clause: Specify the Table Names to be used in the Conditional Clause eg: JOBHEADER,CUSTOMERMASTER
    • Conditional Clause: Specify the conditioning syntax from the 'where' clause in the SQL. eg: JOBHEADER.CUSTOMER = CUSTOMERMASTER.CUSTOMER and CUSTOMERMASTER.CUSTOMERTYPE = 'Services' and JOBHEADER.JOBCATEGORY = 'Plumbing' 





Examples:

On Insert when Blank:


Suppose we want to default the field SALESPERSON value to "Jane Steel" if that field is left blank when a new Customer is added.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

CUSTOMERMASTER

SALESPERSON

On Insert when Blank

Jane Steel





Suppose we want to default the field ADDITIONALFIELD_1 value to "12345" if that field is left blank when a new Item is added.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

ITEMMASTER

ADDITIONALFIELD_1

On Insert when Blank

12345





Suppose we want to default the field ABCCLASS value to "A" if that field is initially blank and if the Analysis Group is set to 'Materials' when a new Item is added.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

ITEMMASTER

ABCCLASS

On Insert When Blank

'A'

ITEMMASTER

ITEMMASTER.ANALYSISGROUP = 'Materials'



On Insert and Update when Blank:


Suppose we want to default the field JOBCATEGORY value to "Repair" if that field is left blank when a new Job is added or updated.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

JOBHEADER

JOBCATEGORY

On Insert and Update when Blank

Repair





Suppose we want to default the field SALESPERSON value to "Jane Steel" if that field is left blank and when the Customer Region is set to 'Asia' when a new Customer or updated.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

CUSTOMERMASTER

SALESPERSON

On Insert and Update when Blank

Jane Steel

CUSTOMERMASTER

CUSTOMERREGIONCODE = 'Asia'



Suppose we want to default the Job field SALESPERSON value to "Bob Drum" if that field is left blank and when the Job Customers Customer Type is set to 'Services' and where the Job Category is set to 'Plumbing' when a new Job Order is Created or updated.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

JOBHEADER

SALESPERSON

On Insert and Update when Blank

Bob Drum

JOBHEADER,CUSTOMERMASTER

JOBHEADER.CUSTOMER = CUSTOMERMASTER.CUSTOMER and CUSTOMERMASTER.CUSTOMERTYPE = 'Services' and JOBHEADER.JOBCATEGORY = 'Plumbing' 

On Insert Always:


Suppose we want to force the field Workflow Status value to "Goods In Picking" when a new Sales Delivery is created.


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

SALESDELIVERYHEADER

WORKFLOWSTATUS

On Insert Always

Goods In Picking





On Insert and Update Always:


Suppose we always want to force a field value of "Assembly" to the SOURCEDBY field if the Item Category = 'Wagons'


Table Name

Field Name

Default When

Default Field Value

From Clause

Conditional Clause

ITEMMASTER

SOURCEDBY

On Insert and Update Always

Assembly

ITEMMASTER

ITEMMASTER.ITEMCATEGORY = 'Wagons'