Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Windows Dynamic Data Exchange : Exchanging data in conversations : Demand-driven exchanges : Request and send exchanges
 
Request and send exchanges
You can use the DDE REQUEST statement to retrieve any server data item as a character string value. If you plan to convert the string value to another ABL data type (for example, DATE), you must convert the string to the correct format.
You can use the DDE SEND statement to send a character string value to any server data item. You must ensure that the string conforms to a format acceptable to the server data item.
You might use request and send exchanges to create new database records from the rows of a worksheet, or iteratively read a OpenEdge database and fill out worksheet rows from selected records. For example, the following code fragment fills out an Excel worksheet using three fields from the Customer table of the sports2000 database:
DEFINE VARIABLE itemn AS CHARACTER NO-UNDO.
DEFINE VARIABLE rowi  AS INTEGER   NO-UNDO.
DEFINE VARIABLE sheet AS INTEGER   NO-UNDO.
...

DDE SEND sheet SOURCE "Name" ITEM "r1c1".
DDE SEND sheet SOURCE "Balance" ITEM "r1c2".
DDE SEND sheet SOURCE "State" ITEM "r1c3".

rowi = 2.
FOR EACH Customer NO-LOCK
  WHERE Customer.Balance > 10000 BY Customer.Balance:
itemn = "R" + STRING(rowi) + "C1".
DDE SEND sheet SOURCE Customer.Name ITEM itemn.
itemn = "R" + STRING(rowi) + "C2".
DDE SEND sheet SOURCE STRING(Customer.Balance) ITEM itemn.
itemn = "R" + STRING(rowi) + "C3".
DDE SEND sheet SOURCE STRING(Customer.State) ITEM itemn.
  rowi = rowi + 1.
END.
In the example, the first three DDE statements send column titles to the first three columns of the first row of the worksheet. Then, for each Customer record showing more than $10,000 in payables, the DDE statements send the customer's name, balance, and state of residence to the appropriate columns of the next row in the worksheet.