Progress
ADM 2 Reference
submitForeignKey (data.p)
Called from submitRow. Defines Foreign Key values for a new row.
Parameters:INPUT pcRowIdent
The RowIdent (a comma-delimited list of ROWIDs that uniquely identify the RowObject record) of the new RowObject record to be stored in the database. Since this is a new record, only the first ROWID (that of the RowObject itself) is valid. There are no database ROWIDs because they have not yet been created.
INPUT-OUTPUT pcValueList
A CHR(1)-delimited list of column and value pairs to be set in the RowObject record identified by pcRowIdent. On input it is a list that has been set before submitForeignKey was called. On output it is the now current list with the addition of any foreign fields that have been set.
INPUT-OUTPUT pcUpdColumns
A comma-delimited list of column names that are updatable in the SmartDataObject. If any ForeignFields are set and added to the pcValueList, they will also be added to pcUpdColumns to let the calling code know that it is permissible to update them.
Returns: Nothing (procedure)Notes:
- The list of updatable fields (pcUpdColumns—derived from the UpdatableColumns property in submitRow) usually does not contain key fields. However, because submitForeignKey is called when creating a new RowObject record, key fields need to be populated, so pcUpdColumns is expanded to allow for this. However, only the variable pcUpdColumns is expanded. The UpdatableColumns property remains unchanged.
- This procedure allows foreign key values to be assigned automatically when new records are created. For example, if the current SmartDataObject is for Orders of the current Customer, where the Customer is maintained in a parent SmartDataObject query, then when new orders are added, the CustNum value for the current Customer should be assigned automatically to all newly created Orders. This procedure does that by adding the CustNum field and its value to the list of modified fields. In addition, since these ForeignFields are often not directly updatable (would not be enabled in a visualization), the code also needs to let the calling code (the submitRow function) know that the Foreign Field update should be allowed. It is for this reason that the UpdColumns parameter is passed; the key fields being updated will be added to the parameter value if they are not already there. As noted, this will modify the list of updatable columns only for this one transaction; it does not cause the caller to modify the UpdatableColumns property itself.
- The submitForeignField procedure can be localized in a particular application’s SmartDataObject to make other changes to the initial values of newly created records by modifying the two INPUT–OUTPUT parameters as described here; what is done in the standard code for ForeignFields can be done by application code for other fields to be initialized.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |