project BLF > class Persistence (Progress) > method GetNextValue

function returns integer

Description

Lookup next-value of a database sequence


Parameters


icSequenceinputcharacterdatabase sequence name

It is possible to provide extra sequences not known in the application database by extending the persistence layer class and adding a method named 'Next<icSequence>' which will be responsible for returning a unique value.


Internal usage


BLF
method Progress.LoadDraftInstance
method Progress.WriteCopy

QadFinancials
method BCInvoice.PostSaveDynamicCreations
method BDInvoice.PostSaveDynamicCreations
method BHistoryDaemonProcessor.PerformWorkItemDIRECTCreatePostingSafCombined
method BHistoryDaemonProcessor.PerformWorkItemDIRECTUpdPHist
method BHistoryDaemonProcessor.PerformWorkItemDIRECTUpdPHistFRW
method BPosting.PostSaveDynamicCreations
method BPostingHist.PostSaveCreateDIRECT
method BPostingHist.RebuildHistory
method Progress.NextMfgIehHist
method Progress.NextMfgOid
method Progress.NextMfgSodresId


program code (program1/progress.p)

find first tSequenceList where
           tSequenceList.tcSequenceName = icSequence no-error.
if not available tSequenceList
then do:
    create tSequenceList.
    assign tSequenceList.tcSequenceName = icSequence.

    /* internal procedure overrides database access */
    if can-do ({&TARGETPROCEDURE}:internal-entries,"Next":U + icsequence)
    then assign tSequenceList.tcDatabaseName = "_run":U.
    else
       assign tSequenceList.tcDatabaseName = <M-13 GetSeqDB  (input  icSequence (icSequence)) in Progress>.
end.

if tSequenceList.tcDatabaseName = "_run":U
then do:
    run value ("Next":U + icsequence) in {&TARGETPROCEDURE}
       (output viDBV).
    return viDBV.
end.
else if tSequenceList.tcDatabaseName = ""
then return ?.
else return dynamic-next-value(icSequence,tSequenceList.tcDatabaseName).