Progress
Language Reference


DDE GET Statement

Interfaces
OS
SpeedScript
All
Windows only
No

Retrieves the value of a dynamic data exchange (DDE) server data item that has changed and triggered a DDE-NOTIFY event.

SYNTAX

DDE GET ddeid TARGET field ITEM name
  [ TIME seconds ]
  [ NO-ERROR ] 

ddeid

An integer expression that specifies the channel number of the conversation that triggered the DDE-NOTIFY event. You can obtain the value of ddeid from the DDE-ID attribute of the frame to which the DDE-NOTIFY event was posted.

TARGET field

Specifies a character field or variable that receives the value of the server data item as a character string.

ITEM name

Specifies the server data item that changed and triggered the DDE-NOTIFY event, where name is a character expression that identifies the name of the data item in the server application. You can obtain the value of name from the DDE-ITEM attribute of the frame to which the DDE-NOTIFY event was posted.

TIME seconds

Specifies the maximum number of seconds that the Progress client waits for the DDE GET statement to complete where seconds is an integer expression. If you do not specify the TIME option or specify a value of 0, Progress waits indefinitely for the statement to complete.

NO-ERROR

By default, if the statement fails to retrieve the data item value, it sets the Progress error condition, and posts the error to the DDE frame DDE-ERROR attribute. If you specify NO-ERROR, the statement does not set the Progress error condition but does post the error to the DDE frame.

EXAMPLE

The following fragment shows how to use the DDE GET statement to set up a procedure to capture a rate-of-change value as it changes in a dynamic model run in a Microsoft Excel worksheet. The example assumes that the Microsoft Excel application is running, and has opened the default Excel worksheet, Sheet1, which runs the model.

After the conversation is opened, the DDE ADVISE statement links to the worksheet cell that maintains the latest rate-of-change value (2nd column of the 4th row, or R4C2). Every time this cell changes value, Progress posts a DDE-NOTIFY event to the frame DDEframe, where the value is retrieved using the DDE GET statement, and stored as a decimal in the ChangeRate variable. Meanwhile, if the REPEAT block detects a ChangeRate value greater than 7.5%, the the link to cell R4C2 is closed and the procedure continues.

DEFINE VARIABLE Sheet1 AS INTEGER.         /* DDE-ID to worksheet     */
DEFINE VARIABLE ChangeRate AS DECIMAL      /* Rate of change variable */
   INITIAL 0.0.                            /*    starting at 0     */
DEFINE VARIABLE CellData AS CHARACTER.     /* Worksheet cell output   */
DEFINE VARIABLE DDEframe AS WIDGET-HANDLE. /* DDE frame handle        */

CREATE FRAME DDEframe
TRIGGERS: /* DDE frame and code to receive  */
  ON DDE-NOTIFY DO:      /* rate of change data from Excel */
    DDE GET Sheet1 TARGET CellData ITEM "R4C2".
    ChangeRate = DECIMAL(CellData).
  END.
END TRIGGERS.
                       .
                       .
                       .
/* Open conversation with Sheet1 and link to rate-of-change value. */
DDE INITIATE Sheet1 FRAME DDEframe APPLICATION "Excel" TOPIC "Sheet1".
DDE ADVISE Sheet1 START ITEM "R4C2".

/* Do some processing while the rate-of-change is within 7.5% */
REPEAT WHILE ChangeRate <= 7.5:
                       .
                       .
                       .
END. /* 7.5% processing */

/* Go on to other things once the rate of change goes above 7.5%. */


DDE ADVISE Sheet1 STOP ITEM "R4C2".
                       .
                       .
                       . 

NOTES

SEE ALSO

DDE ADVISE Statement, DDE INITIATE Statement


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