Description
Actions to take before writing current instance to the database (inside the db transaction!).
Use the field tc_status to test the status of the updated records:
'' = unchanged
'N' = new
'C' = changed
'D' = deleted
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program/bdebtorbalance.p)
<ANCESTOR-CODE>
/* Return in case there is nothing to do */
if not can-find (first tDebtorHighCreditWriteDirect)
then Return.
/* Start the persistance - hold the returned hanlde to in anothe data-item as we need ti repetitively */
<M-1 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BDebtorBalance>
if viFcReturnSuper <> 0
then do :
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end. /* if viFcReturnSuper <> 0 */
assign vhPersistanceViaFcComponent = vhFcComponent.
/* Go through all tDebtorHighCreditWriteDirect record and update some fields in the debtor record */
for each tDebtorHighCreditWriteDirect :
/* Reset vhFcComponent and build-up the where-clause */
assign vhFcComponent = vhPersistanceViaFcComponent
vcWhereClause = "for each debtor where debtor.debtor_ID = ":U + string(tDebtorHighCreditWriteDirect.tiDebtorID).
/* Use write-driect to do the update */
<M-2 run WriteDirect
(input 'debtor':U (icTableName),
input vcWhereClause (icPrepare),
input 'DebtorHighCredit,DebtorHighCreditDate':U (icFieldList),
input 'd,t':U (icFieldListDataTypes),
input string(tDebtorHighCreditWriteDirect.tdDebtorHighCredit) + chr(2) + string(tDebtorHighCreditWriteDirect.ttDebtorHighCreditDate) (icAbsolute),
input '':U (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in persistence>
if viFcReturnSuper <> 0
then do :
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end. /* if viFcReturnSuper <> 0 */
end. /* for each tDebtorHighCreditWriteDirect : */
/* empty temp-tbale as the content is no longer needed */
empty temp-table tDebtorHighCreditWriteDirect.