Getting Started with TRANSACT (32247-90007)
178 Chapter9
Creating Custom Applications
Transactions Across Multiple Datasets
Figure 9-34. Multiple Dataset Screen
The key to understanding how to write generic code is to understand how the VPLUS and
Image interface work with the list register.
The first thing to understand is that the list register can have as many definitions of an
element on it as you want. However, Transact always references the latest definition. Thus
when we do a LIST(AUTO) for each dataset that the transaction is to access, we are
putting three definitions of part-number in the list register.
The VPLUS interface with the dictionary does not require us to use the LIST= option. If
this is left off, Transact matches the elements that are a part of the form with the current
contents of the list register. These elements can occur anywhere physically in the list
register. Elements are resolved by starting at the end (most recent change) of the list
register, and working back until the element definition is found (line 10).
The Image interface through LIST=(@) requires the element list to be contiguous. We
cannot list the individual elements, since this would defeat the idea of creating custom
code. Thus after updating the parts dataset (line 11), we need to save the value of
part-number (line 12) and then remove all of the parts dataset elements (line 13), then
restore part-number which now will be the part-number defined for dataset inventory (line
14). A record is then added to the inventory dataset.
Since part-number has already been saved, we do not need to save it again, but can now
remove the elements that belong to the inventory set from the LIST and then restore
part-number which now becomes the part-number for the partvendors set.
This same logic can be repeated any number of times. Similar logic also handles data
retrieval from different sets.
addpart add a part
part number [ ]
description [ ]
location [ ]
quantity [ ]
vendor code [ ]
vendor name [ ]