Progress
Language Reference


CURRENT-VALUE Function

Interfaces
OS
SpeedScript
All
All
Yes

Returns the current integer value of a sequence defined in the Data Dictionary.

SYNTAX

CURRENT-VALUE ( sequence [ , logical-dbname ] ) 

sequence

An identifier that specifies the name of a sequence defined in the Data Dictionary.

logical-dbname

An identifier that specifies the logical name of the database in which the sequence is defined. The database must be connected. You can omit this parameter if the sequence name is unambiguous. If a sequence with this name exists in more than one connected database, then you must specify logical-dbname.

EXAMPLE

The following example finds the current value of the next-cust-num sequence and then looks for orders with that customer number.

r-curval.p
DEFINE VARIABLE cur-cust LIKE customer.cust-num NO-UNDO.

cur-cust = CURRENT-VALUE(next-cust-num).
IF CAN-FIND(FIRST order WHERE order.cust-num = cur-cust) THEN
  FOR EACH order WHERE order.cust-num = cur-cust,
      EACH order-line OF order NO-LOCK
      BREAK BY order.order-num:
  
      IF FIRST-OF(order.order-num) THEN
        DISPLAY order.order-num order.order-date order.cust-num
          WITH FRAME order-info CENTERED ROW 2 1 COL.
   
      DISPLAY order-line.
  END.
ELSE DO:
  FIND FIRST customer WHERE customer.cust-num = cur-cust
        NO-LOCK NO-ERROR.

  IF AVAILABLE customer THEN   
     MESSAGE "No Orders Exist for Customer " + customer.name +
          ", " + string(customer.cust-num)
          VIEW-AS ALERT-BOX INFORMATION BUTTONS OK TITLE "No Orders".
  ELSE MESSAGE "Customer number" cur-cust "does not exist."
          VIEW-AS ALERT-BOX INFORMATION BUTTONS OK TITLE "No Customer".
END. 

NOTES

SEE ALSO

CURRENT-VALUE Statement, NEXT-VALUE Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095