Try OpenEdge Now
skip to main content
ProDataSets
Updating Data with ProDataSets : Processing changes : MARK-ROW-STATE method
 

MARK-ROW-STATE method

If a ProDataSet contains changes to be applied to a Data-Source, but no before-table records exist for it, you might still want to use the SAVE-ROW-CHANGES method to move the new data from the ProDataSet to the source database. This might be the case if the client does not have the ability to create before-table records, such as a third-party .NET application or some incoming XML or JSON with changed data, but no before-table records. The MARK-ROW-STATE method of the buffer handle creates the before-table records needed by SAVE-ROW-CHANGES, usually from independently pre-saved records on the server, as shown in the following syntax:

Syntax

MARK-ROW-STATE( row-state[, before-image source buffer handle] )
row-state is an integer expression that evaluates to one of the row-state values or one of the compiler constants ROW-CREATED, ROW-MODIFIED or ROW-DELETED as shown in the following table.
Compiler constant
Value
Description
ROW-UNMODIFIED
0
The row was not modified.
ROW-DELETED
1
The row was deleted.
ROW-MODIFIED
2
The row was modified.
ROW-CREATED
3
The row was created.
before-image source buffer handle is an optional handle to the before-image source buffer.
If row-state is ROW-UNMODIFIED or if there is already a before-table record, no action is taken.
If row-state is ROW-CREATED, a before-table record is created and its ROW-STATE is marked as ROW-CREATED. The before-table record is associated with the buffer handle record.
If row-state is ROW-MODIFIED and the second optional parameter is defined, a before-image record is created by copying the before-image source buffer. If the second parameter is not defined, then a Data-Source must be attached to the buffer handle. In this case, the Data-Source mapping is used to locate the Data-Source record(s) related to the buffer handle, which is used to create a before-table record. The before-table record is marked ROW-MODIFIED and is associated with the buffer handle record.
Note: If the second parameter is not defined and if the Data-Source top level record cannot be located, then a ROW-CREATED before-table record will be created and associated with the buffer handle record.
If row-state is ROW-DELETED and the second optional parameter is defined, a before-image record is created by copying the before-image source buffer. If the second parameter is not defined, then a Data-Source must be attached to the buffer handle. In this case, the Data-Source mapping is used to locate the Data-Source record(s) related to the buffer handle, which then can be used to create a before-table record.
If a second parameter is not defined, then the buffer handle must contain a temporary record whose only purpose is to locate the Data-Source. Otherwise, it can be empty.
Note that if buffer handle is for a static table that was defined without a BEFORE-TABLE option, MARK-ROW-STATE causes the AVM to raise ERROR. If buffer handle is for a dynamic table that has no before-table, one is automatically created.