skip to main content
OpenEdge Development: ADM and SmartObjects
Advanced ADM Topics : Using GroupAssign SmartLinks
 
Using GroupAssign SmartLinks
GroupAssign SmartLinks are intended for grouping updates in multiple SmartDataViewers into one transaction. To do this, you link a master SmartDataViewer to the SmartDataObject with an Update SmartLink, use GroupAssigns to link this SmartDataViewer to the other SmartDataViewers that will be grouped with it. When the updateRecord procedure executes, the collectChanges procedure runs for the master SmartDataViewer, to collect changed field values from all its GroupAssign-Targets. The collected changes serve as the input to the submitRow procedure in the data source that updates the database. Figure 6–6 illustrates this process. The arrows in the figure indicate SmartLinks.
Figure 6–6: Grouping updates with GroupAssign SmartLinks
Note the SmartLinks in Figure 6–6:
*The Customer SmartDataObject is linked to each Customer SmartDataViewer with a Data SmartLink.
*The master SmartDataViewer is linked to the SmartDataObject with an Update link.
*The master SmartDataViewer is linked to each of the other SmartDataViewers, in a star pattern, with a GroupAssign SmartLink.
*The Update SmartPanel is linked to the master SmartDataViewer with a TableIO SmartLink.
The following procedure outlines how to use the Customer table in the Progress sample database, links various SmartDataViewers with GroupAssign SmartLinks so that the application can update a single customer record across multiple SmartDataViewers.
To update a single customer record across multiple SmartDataViewers:
1. Create a SmartDataObject for the Customer table.
2. Create a SmartDataViewer for the Customer table that contains the following fields:
*CustNum
*Name
*Contact
*Phone
*Fax
*EmailAddress
Name this SmartDataViewer vcustcontact.w. This is the master SmartDataViewer.
3. Create a second SmartDataViewer for Customer table that contains the following fields:
*Address
*Address2
*City
*State
*PostalCode
*Country
Name this SmartDataViewer vcustaddress.w.
4. Create a SmartWindow and on it create a SmartFolder with two tabs, labeled Contact and Address.
5. Drop the SmartDataObject onto the window.
6. Drop the vcustcontact.w SmartDataViewer (the master SmartDataViewer) onto page 1 of the SmartWindow and link it to the SmartDataObject with Data and Update links.
7. Drop the vcustaddress.w SmartDataViewer onto page 2 of the SmartWindow and add SmartLinks as follows:
*A Data link from the SmartDataObject to this SmartDataViewer
*A GroupAssign link from the vcustcontact.w (master) SmartDataViewer to this SmartDataViewer
8. Drop an Update SmartPanel onto page 0 of the window and link it to the vcustcontact.w (master) SmartDataViewer.
When this application is run, it can make updates to a single record through both SmartDataViewers. These updates are saved together, updating the database with all changes to a single customer record in one transaction.