table.POST Function
Syntax
Description
Specify the required values in the Post dot variable, then use the following command:
- Variable
- Type and Description
- Post.t_db
Type "C". The filename of the secondary, Transaction table.
- Post.m_key
Type "C". Contains expression strings that describe how fields or combinations of fields form the linking key in the primary, master table.
- Post.t_key
Type "C". Contains expression strings that describe how fields or combinations of fields form the linking key in the secondary, transaction table.
- Post.m_filter
Type "L". Optional. Default = .T. (All records). A character filter expression that specifies the records in the Master table that can be changed during the Post operation.
- Post.t_filter
Type "L". Optional. Default = .T. (All records). A character filter expression that specifies which records from the secondary, transaction table will be posted. Only the subset of records that pass through the Post.t_filter are filter are used when searching for existing records.
- Post.m_count
Type "N". Indicates how many fields are being mapped for the Post operation.
- Post.m_field1 ... Post.m_fieldN
Type "C". N fields (1 ... N) that specify the names of the fields in the primary, master table, which is the target of the Post operation.
- Post.m_exp1 ... Post.m_expN
N fields (1 ... N) that contain the value, field, or expression used to add, subtract, or replace values in the Master table. You must prefix the transaction table name with @ in expressions (e.g., @inv_items -> quantity ). The following table shows examples of how to form the expression for Replace, Add and Subtract posting operations:
- Master Field and Transaction Field
- Operation and Expression
- On_hand, Inv_items->Qty
Replace, @inv_items -> qty
- On_hand, Inv_items->Qty
Add, On_hand + @inv_items -> qty
- On_hand, Inv_items->Qty
Subtract, On_hand-@inv_items -> qty
- Post.t_count
Type "N". Updating the secondary, transaction table lets you change records used during the Post operation. as in the master mapping, each Transaction mapping is expressed through a group of parameters. post.t_count indicates how many fields are being mapped for the Post operation.
- Post.t_case1 ... Post.t_caseN
Type "C". N fields (1 ... N) that specify the conditions under which the Transaction table will be updated. The following values are allowed.
- "Posted" = Records that successfully posted a value(s)
- "No-match" = Records that do not match any Master records
- "Violated" = Records that failed during the operation
- Post.t_field1 ... Post.t_fieldN
Type "C". N fields (1 ... N) that specify the name of the secondary, transaction Field to be updated
- Post.t_exp1 ... Post.t_expN
Type "A". N fields (1 ... N) that contains a value, field, or expression assigned to the secondary, transaction field. You must prefix the transaction table name with @ in expressions (e.g., @inv_items -> quantity ).
Description
Replace, add, or subtract fields values in the table using fields from a transaction database.
Discussion
The <TBL>.POST() method is a high-level utility used to replace, add, or subtract field values in the Master table using field values from a Transaction table.
Example
This script subtracts values from a transaction table ( Inv_item ) to the inventory table ( Product ). Only records not previously posted are posted (i.e. records for which POSTED = .f.).
dim tbl as P tbl = table.open("c:\a5\a_sports\product.dbf") post.t_db = "c:\a5\a_sports\inv_item" post.m_key = "PROD_NO" post.t_key = "PROD_NO" post.m_filter = "" post.t_filter = ".not. POSTED" post.m_count = 1 post.m_field1 = "QTY_ON_HAND" post.m_exp1 = "QTY_ON_HAND - @INV_ITEM->QTY" post.t_count = 0 tbl.post() ui_msg_box("Note To User","Operation Complete")
See Also