Consultor Eletrônico



Kbase P126599: How do I set the value of a sequence without changing the initial value or cycling through using the
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   26/10/2007
Status: Unverified

GOAL:

How do I set the value of a sequence without changing the initial value or cycling through using the NEXT-VALUE function until I reach the desired value?

GOAL:

How to update the value of a sequence?

GOAL:

How to change the value of a sequence?

GOAL:

I forgot to load my sequence values, how do I update the values of the sequences?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x
Progress 9.1E

FIX:

To update/assign the value of a sequence without changing its initial value or using NEXT-VALUE in a loop until the sequence value is up to date, you can use the CURRENT-VALUE or DYNAMIC-CURRENT-VALUE statements. These statements serve dual purposes, since using them you can either display the the current value of a sequence or update it. When used for display they are considered FUNCTIONS, however when they are used to update a value they are considered STATEMENTS. In Progress 9.1E and OpenEdge 10.0A the DYNAMIC-CURRENT-VALUE syntax was added in order to allow developers to specify the name of the sequence and the database as string values or from a variable. The syntax of both paradigms is listed below along with examples. CURRENT-VALUE(<sequenceName> [,<db-name>]) = <value>. Example: CURRENT-VALUE(NextCustNum,sports2000) = 4565. DYNAMIC-CURRENT-VALUE("<sequenceName>" [,"<db-name>"]) = <value>. Example: PROCEDURE setCurrentSeqValue: DEFINE INPUT PARAMETER pcSequence AS CHARACTER NO-UNDO. DEFINE INPUT PARAMETER pcDatabase AS CHARACTER NO-UNDO. DEFINE INPUT PARAMETER piCurrentValue AS INTEGER NO-UNDO. DYNAMIC-CURRENT-VALUE(pcSequence,pcDatabase) = piCurrentValue. END PROCEDURE.