Progress
Language Reference


DDE REQUEST Statement

Interfaces
OS
SpeedScript
All
Windows only
No

Retrieves the current value of a dynamic data exchange (DDE) server data item associated with the specified DDE conversation.

SYNTAX

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

ddeid

An integer expression that equals the channel number of the conversation opened for the specified data item. It is the value returned by the DDE INITIATE statement that opened the conversation.

TARGET field

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

ITEM name

Specifies the name of the server data item from which to retrieve a value. The data item name is a character expression that identifies the data item according to the conventions of the server application (for example, the row and column coordinates of a worksheet cell, such as R2C1 in Microsoft Excel).

TIME seconds

Specifies the maximum number of seconds that the Progress client waits for the DDE REQUEST 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 a typical use of the DDE REQUEST statement. It assumes that the Microsoft Excel application is running, and has created the default Excel worksheet, Sheet1. It then uses the DDE INITIATE statement to open a conversation with Sheet1 as the topic. This allows Progress to exchange data with the cells of the worksheet.

In this example, the fragment builds 10 new customer records from data obtained from the first 4 columns in the worksheet using the DDE REQUEST statement. The data includes customer name, year-to-date sales, state, and zip code. (The requests start from row 2, because row 1 contains column headings.)

DEFINE VARIABLE Rowi AS INTEGER.          /* Worksheet row counter     */
DEFINE VARIABLE ItemName AS CHARACTER.    /* Item Name                 */
DEFINE VARIABLE CustName AS CHARACTER.    /* Customer name receptor    */
DEFINE VARIABLE YTDsales AS CHARACTER.    /* YTD sales receptor        */
DEFINE VARIABLE StateAbr AS CHARACTER.    /* State name receptor       */
DEFINE VARIABLE ZipCode AS CHARACTER.     /* Zip code receptor         */
DEFINE VARIABLE Sheet1 AS INTEGER.        /* DDE-ID to worksheet topic */
DEFINE VARIABLE DDEframe AS WIDGET-HANDLE./* DDE frame handle          */

CREATE FRAME DDEframe.                    /* Create DDE frame.         */
                       .
                       .
                       .
/* Open a DDE conversation with Sheet1 and create 10 customer */
/* records from the data in four columns of the worksheet.      */

DDE INITIATE Sheet1 FRAME DDEframe APPLICATION "Excel" TOPIC "Sheet1".

REPEAT Rowi = 2 TO 11:
  CREATE customer.
  customer.cust-num = Rowi - 1.
  ItemName = "R" + STRING(Rowi) + "C1".
  DDE REQUEST Sheet1 TARGET CustName ITEM ItemName.
  customer.name = CustName.
  ItemName = "R" + STRING(Rowi) + "C2".
  DDE REQUEST Sheet1 TARGET YTDsales ITEM ItemName.
  customer.ytd-sls = DECIMAL(YTDsales).
  ItemName = "R" + STRING(Rowi) + "C3".
  DDE REQUEST Sheet1 TARGET StateAbr ITEM ItemName.
  customer.st = StateAbr.
  ItemName = "R" + STRING(Rowi) + "C4".
  DDE REQUEST Sheet1 TARGET ZipCode  ITEM ItemName.
  customer.zip = INTEGER(ZipCode).
  RELEASE customer.
END.
                       .
                       .
                       . 

NOTE

For more information on using the DDE protocol to exchange data with non-Progress applications, see the Progress External Program Interfaces manual.

SEE ALSO

DDE INITIATE Statement


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