(Windows only)
Retrieves the current value of a dynamic data exchange (DDE) server data item associated with the specified DDE conversation.
This statement is supported only for backward compatibility. Use the Component Object Model (COM) instead.
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 the AVM 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 NO-UNDO. /* Worksheet row counter */ DEFINE VARIABLE ItemName AS CHARACTER NO-UNDO. /* Item Name */ DEFINE VARIABLE CustName AS CHARACTER NO-UNDO. /* Customer name receptor */ DEFINE VARIABLE YTDsales AS CHARACTER NO-UNDO. /* YTD sales receptor */ DEFINE VARIABLE StateAbr AS CHARACTER NO-UNDO. /* State name receptor */ DEFINE VARIABLE ZipCode AS CHARACTER NO-UNDO. /* Zip code receptor */ DEFINE VARIABLE Sheet1 AS INTEGER NO-UNDO. /* DDE-ID to worksheet */ DEFINE VARIABLE DDEframe AS HANDLE NO-UNDO. /* 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.CustNum = 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.YtdSls = DECIMAL(YTDsales). ItemName = "R" + STRING(Rowi) + "C3". DDE REQUEST Sheet1 TARGET StateAbr ITEM ItemName. Customer.State = StateAbr. ItemName = "R" + STRING(Rowi) + "C4". DDE REQUEST Sheet1 TARGET ZipCode ITEM ItemName. Customer.PostalCode = INTEGER(ZipCode). RELEASE Customer. END. . . . |