Created
January 16, 2018 13:19
-
-
Save tamboer/a2b3cfd36e70cc0b4ad208f2c28044d6 to your computer and use it in GitHub Desktop.
test openedge dataset with multiple temp tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DEFINE TEMP-TABLE ttOrderInfo NO-UNDO serialize-name "orderList" | |
| FIELD mapReference AS INTEGER | |
| FIELD customerNumber AS CHARACTER | |
| INDEX byMapReference IS PRIMARY mapReference. | |
| DEFINE TEMP-TABLE ttMachineinfo NO-UNDO serialize-name "machineInfo" | |
| FIELD mapReference AS INTEGER SERIALIZE-HIDDEN | |
| FIELD category AS CHARACTER | |
| FIELD subcategory AS CHARACTER | |
| INDEX byMapReference IS PRIMARY mapReference. | |
| DEFINE TEMP-TABLE ttDeliveryAddress NO-UNDO serialize-name "deliveryAddress" | |
| FIELD mapReference AS INTEGER SERIALIZE-HIDDEN | |
| FIELD street AS CHARACTER | |
| FIELD country AS CHARACTER | |
| INDEX byMapReference IS PRIMARY mapReference. | |
| DEFINE DATASET testDS SERIALIZE-HIDDEN FOR ttOrderInfo, ttMachineinfo, ttDeliveryAddress | |
| DATA-RELATION FOR ttOrderInfo, ttMachineinfo RELATION-FIELDS(mapReference, mapReference) NESTED | |
| DATA-RELATION FOR ttOrderInfo, ttDeliveryAddress RELATION-FIELDS(mapReference, mapReference) NESTED. | |
| run testDataset. | |
| procedure fillDataset private: | |
| /*------------------------------------------------------------------------------ | |
| Purpose: Test dataset conversion | |
| Notes: | |
| ------------------------------------------------------------------------------*/ | |
| DEFINE OUTPUT PARAMETER DATASET FOR testDS. | |
| CREATE ttOrderInfo. | |
| ASSIGN ttOrderInfo.mapReference = 1 | |
| ttOrderInfo.customerNumber = "PUYLAERT INDUSTRIES". | |
| CREATE ttMachineinfo. | |
| ASSIGN ttMachineinfo.mapReference = 1 | |
| ttMachineinfo.category = "ROUGH_TERAIN_FORKLIFT" | |
| ttMachineinfo.subcategory = "ROUGH_TERAIN_FORKLIFT". | |
| CREATE ttDeliveryAddress. | |
| ASSIGN ttDeliveryAddress.mapReference = 1 | |
| ttDeliveryAddress.country = "BE" | |
| ttDeliveryAddress.street = "Brabantstraat". | |
| CREATE ttOrderInfo. | |
| ASSIGN ttOrderInfo.mapReference = 2 | |
| ttOrderInfo.customerNumber = "VERELST INDUSTRIEBOUW". | |
| CREATE ttMachineinfo. | |
| ASSIGN ttMachineinfo.mapReference = 2 | |
| ttMachineinfo.category = "SCISSOR_LIFT" | |
| ttMachineinfo.subcategory = "ART_SCISSOR_LIFT". | |
| CREATE ttDeliveryAddress. | |
| ASSIGN ttDeliveryAddress.mapReference = 2 | |
| ttDeliveryAddress.country = "BE" | |
| ttDeliveryAddress.street = "Weststraat". | |
| end procedure. | |
| procedure testDataset private: | |
| /*------------------------------------------------------------------------------ | |
| Purpose: Test dataset conversion | |
| Notes: | |
| ------------------------------------------------------------------------------*/ | |
| define variable lcJsonMessage as longchar no-undo. | |
| run fillDataset(OUTPUT DATASET testDS). | |
| dataset testDS:write-json("file", "D:\ownCloudWille548\4214.tvh\q.one.LINK\MAP-LINK\001-test-write-ds.json"). | |
| dataset testDS:write-json("longchar", lcJsonMessage). | |
| dataset testDS:empty-dataset(). | |
| dataset testDS:write-json("file", "D:\ownCloudWille548\4214.tvh\q.one.LINK\MAP-LINK\002-test-write-ds-empty.json"). | |
| dataset testDS:read-json("longchar", lcJsonMessage). | |
| dataset testDS:write-json("file", "D:\ownCloudWille548\4214.tvh\q.one.LINK\MAP-LINK\003-test-read-ds.json"). | |
| define variable csvOut as character init 'D:\ownCloudWille548\4214.tvh\q.one.LINK\MAP-LINK\9999.csv'. | |
| OUTPUT TO VALUE(csvOut). | |
| EXPORT DELIMITER ";" "######### " + String(NOW) + " #########". | |
| FOR EACH ttMachineinfo: | |
| EXPORT DELIMITER ";" | |
| ttMachineinfo. | |
| END. | |
| OUTPUT CLOSE. | |
| end procedure. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment