MasterRecordSQLExitRoutine

advertisement
Master Record SQL Exit
When a “Master Record” is saved the system executes three SQL statements that can be
used for many things.
#1 – Update Fields – This routine is used to perform any site specific calculations to
update field values in the Data Dictionary buffer before Request Save is executed. This
means the DD validate checks the values on save.
Column 1 of the result set contains the field NUMBER and column 2 the new value for the
field. Changes made by this process will update the “field change history”.
#2 – Validate Save – This routine determines if the save is allowed.
If no rows are returned the save process continues. If a row is returned the value will be
displayed as an error message. The RECNUM of the saved record is passed to the SQL
query in giPass1.
#3 – Post Save – This query is called after the DD has saved the record. Changes to the
record must be made to the data on disk. To accomplish this, the RECNUM of the saved
record is passed to the SQL query in giPass1. To allow update of the record the
restriction on the use of UPDATE in a query is dropped for the execution of this query.
NOTE – The system does NO validation of this Query.
These queries are stored in the TextData table under the names:
MEX:{tablename}:PRESAVE
MEX:{tablename}:POSTSAVE
MEX:{tablename}:VALIDATE
Table names are: manufac, catalog, inventry, invoices, ……
The queries are passed through the Cove token replacement processor before execution.
Usage Examples
When saving a catalog or inventory record the system can use the UPDATE query to
calculate a new standard cost based on various data, including ATTRIBUTES. For
example a catalog item could have its costs calculated as follows:
1.
2.
3.
4.
Find the preferred vendor for the product (Vendor name in catalog)
Find the qualified vendor list price
Add the vendor freight markup to it
Update the standard cost.
Master Record SQL Exit
Or
1.
2.
3.
4.
5.
6.
Find the preferred vendor for the product (Vendor name in catalog)
Find the qualified vendor list price
Lookup the container cost from the vendor to the warehouse location
Calculate the freight
Add any attribute based costs.
Update the standard cost
Sample Queries
Master Record SQL Exit
Master Record SQL Exit
Download