Dictionary-IV Link Requests – Overview
The READ directive will read the specified Link and return the data in XML format.
SYNTAX:
READ link-name USING KEY “value”; | USING RANGE FROM “value” TO “value”; [BY SORT sort-number;][DATANAME LIST data-name data-name data-name. . .;]
[SELECT WHEN select-clause]link-name | Dictionary-IV Link definition name. |
value | the key value or a key range values for reading the Link. USING KEY and USING RANGE are mutually exclusive. |
sort-number | the Link sort number to be used when reading with a sort other than SORT 0. |
data-name | any data-name defined by the Format. |
select-clause | any Thoroughbred SELECT WHEN clause. |
NOTES
- The USING KEY clause and USING RANGE clause only supports literal key values, #format-name.data-name is not supported. All key values must be properly padded and wrapped in quotes.
- The DATANAME LIST specifies one or more valid data-names from the Format definition associated with the Link. For example, CUST-CODE CUST-NAME CUST-STATE. Only those data elements included in the DATANAME LIST are returned in XML format. A DATANAME LIST is optional. If a DATANAME LIST is not supplied, a default DATANAME LIST will be built using all the data names defined by the Format.
- The SELECT WHEN conditional expression may contain any relational operators supported by the Thoroughbred SELECT WHEN clause. For more information on SELECT WHEN see OPENworkshop online reference manuals.
- The SELECT clause does not support Link data-names; Format data-names must be supplied.
EXAMPLES
READ OELCUST USING KEY "100101"
READ OELCUST USING RANGE FROM "100101" TO "100104"
READ OELCUST USING KEY "Computer Inc. ";BY SORT 1
OELCUST USING RANGE FROM "100100" TO "100999";DATANAME LIST CUST-CODE CUST-NAME SR-CODE;SELECT WHEN #OEFCUST.SR-CODE = "HP"
OELCUST USING RANGE FROM "100100" TO "100999";DATANAME LIST CUST-CODE CUST-NAME SR-CODE;SELECT WHEN #OEFCUST.CUST-CONTACT LIKE "*Smith*"
OELCUST USING RANGE FROM "100100" TO "100999";DATANAME LIST CUST-CODE CUST-NAME SR-CODE;SELECT WHEN #OEFCUST.CUST-SALES > 15000UPDATE
Section titled “UPDATE”The UPDATE directive updates existing records in the data source defined by a Link. The UPDATE clause specifies the Link name, key value, and the data.
SYNTAX
UPDATE link-name <xml-elements> | |
link-name | Dictionary-IV Link definition name. |
<xml-elements> | the supplied data for the update in XML format. |
NOTES
- The first set of xml-elements defines the key to the Link. The key is always required and must be the first set of xml-elements. The order of non-key xml-elements is not significant.
- Before the Link is updated the TS XML DataServer will validate all data against the Format definition. This includes validation using LOOKUP VIEW name.
- If the Link contains an I/O Trigger, the trigger will be executed prior to the WRITE.
- If the Link contains sort definitions all sorts will be updated.
EXAMPLE
UPDATE OELSLRP <SR-CODE>XX</SR-CODE><SR-NAME>Justin Case</SR-NAME>Changes the SR-NAME for SR-CODE “XX” in the data file for the Link (OELSLRP).
INSERT
Section titled “INSERT”The INSERT directive adds a new record to the data source defined by a Link. The INSERT clause specifies the Link name, key value, and the data for the new record.
SYNTAX
INSERT link-name <xml-elements> | |
link-name | Dictionary-IV Link definition name. |
<xml-elements> | the supplied data for the insert in XML format. |
NOTES
- The first set of xml-elements defines the key to the Link. The key is always required and must be the first set of xml-elements. The order of non-key xml-elements is not significant.
- Before the new record is added to the Link the TS XML DataServer will validate all data against the Format definition. This includes validation using LOOKUP VIEW name.
- If the Link contains an I/O Trigger, the trigger will be executed prior to the WRITE.
- If the Link contains sort definitions all sorts will be updated.
EXAMPLE
INSERT OELSLRP <SR-CODE>XX</SR-CODE><SR-NAME>JustinCase</SR-NAME><SR-SALES>0</SR-SALES>Adds a new record to the data file for the Sales Rep Link (OELSLRP).
DELETE
Section titled “DELETE”The DELETE directive deletes a record from the data source defined by a Link. The delete clause specifies the Link name and the key value. The supplied key must be in XML format. All xml-elements are assumed to be key fields.
SYNTAX
DELETE link-name <xml-elements> | |
link-name | Dictionary-IV Link definition name. |
<xml-elements> | the supplied data for the insert in XML format. |
NOTES
- If the Link contains an I/O Trigger, the trigger will be executed prior to the REMOVE.
EXAMPLE
DELETE OELSLRP <SR-CODE>XX</SR-CODE>Removes Sales Rep “XX” from the data file for the Link (OELSLRP).
From the TS XML DataServer Reference, version 8.9.1. Open this page in the PDF