Sequence Names not to be hard-coded - Forum - Progress User Groups - Progress Community

Sequence Names not to be hard-coded

 Forum

Sequence Names not to be hard-coded

This question is answered

/*
I have created a sequences named 'S1' and 'S2'.
it is a requirement to change the sequence names at runtime based
on some conditions and not to be hard-coded.
I was wondering if I could succesfully run the below query.
Any help in this regard will be highly appreciated.
*/


  DEF VAR A AS CHAR.
  A = 'DM'.
  DISP STRING ( NEXT-VALUE ( STRING(A))).

Verified Answer
All Replies
  • Depending on your OE-Release you can use DYNAMIC-NEXT-VALUE.
     

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • /*Following code works for me.

    Dyanmic-next-value works with database name*/

     DEF VAR A AS CHAR.

     A = 'S1'.

     DISP string(DYNAMIC-NEXT-VALUE(A,'dbname')).

  • Thanks Mike ... Much appreciated ...

  • Or when there is only a single DB connected:
     

    DISP DYNAMIC-NEXT-VALUE(A,LDBNAME(1)) .

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.