TITLE:Back-to-Basics: 'b' Bridge Process Code

ISSUE:Multi-value Solutions Jun '98

AUTHOR:Nathan Rector

COMPANY:Natec Systems

EMAIL:nater@northcoast.com

HTTP:www.northcoast.com/~nater/

bfile.reference;ac1;ac2{;{ac3;+|-}|d}

The Bridge Process code is new in Advanced Pick and D3. It allows you to maintain relationships, or bridges between an attribute in one item and an item in another file (or the same file) without the additional programming that originally was required.

Most companies have Accounts Payable (A/P) and Purchase Order (PO) files and keep track of the association between the A/P records and the PO records. Previously this was done by programs. When an Accounts Payable record was created the program would write that record number into the PO file. The Bridge Process Code eliminates that program. By placing the Bridge Process Code into field 8 of the file definition you are able to write the A/P record number into the P.O. file and it is kept correct regardless of how the information is changed through a program or an editor.

The advantage of a bridge correlative is that it performs a function which previously took significant Pick/BASIC coding. When an item is added, changed, or deleted, all the bridge correlatives in the file-defining item of the file dictionary are processed for that item.

file.reference - refers to the file to which the bridge is being built to.

"ac1" - contains the attribute in the current item that contains the item-id of the item in the "bridged-to" file. This attribute may be multi-valued in the current file. If it is multi-valued, all items are updated in the "bridged-to" file.

"ac2" - contains the attribute that the items-id of the current item will be placed into in the "bridge-to" file.

If the optional "operator" parameter is specified, the mathematical result for "ac3" and the value in "ac2" is applied to "ac2".

"ac3;+|-" - adds or subtracts the value of the attribute specified by "ac3" in the current item to the value in the attribute "ac2" in the "bridged-to" item. The inverse operation is performed on a delete. No backward pointer is maintained in the bridged-to item.

If the current item is deleted, the inverse operation is performed to automatically return the value in "ac2" to its original value.

"d" - is used as an override to delete the current item even if "ac1" is not null. Without this option, the current item may not be deleted if the attribute specified by "ac1" contains a value.

All values of "ac1" in the current item are processed. If a value in "ac1" is changed, the value of "ac2" in the original item specified by "ac1" is deleted, and this value is added to attribute "ac2" of the new item pointed to by "ac1".

Examples

bentity;1;5

This example places the item-id of the current item into attribute 5 of the "entity" file. Attribute 1 in the current file contains the item-id in the entity file.

bproduct;2;4;3;+

This example adds the value of attribute 3 in the current item to the value in attribute 4 of the bridged-to item (product file). The result of the addition is stored in attribute 4 of the bridged item.

bentity;1;5;d

This example places the item-id of the current item into attribute 5 of the "entity" file. Attribute 1 in the current file contains the item-id for the entity file. If the current items deleted, the delete will not be rejected even if attribute 1 has a value.