Difference between revisions of "XMLFIRST()"
Yvonne.milne (Talk | contribs) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to read the first record contained in the specified XML file and return the number of fields in the record | Function to read the first record contained in the specified XML file and return the number of fields in the record | ||
− | |||
==Syntax== | ==Syntax== | ||
XMLFIRST(<XML filename>, <memvar1>, <memvar2>, <memvar3>, <array1>, <array2>) | XMLFIRST(<XML filename>, <memvar1>, <memvar2>, <memvar3>, <array1>, <array2>) | ||
− | |||
==See Also== | ==See Also== | ||
− | [[COPY]], [[FETCH]], [[SQL SELECT|SELECT]], [[SET XMLFORMAT]], [[SQL UPDATE|UPDATE]], [[XML]], [[XML_DECODE()]], [[XML_ENCODE()]], [[XML_GATHER()]], [[XML_SCATTER()]], [[XMLCOUNT()]], [[XMLCREATEDTD()]], [[XMLNEXT()]], [[XMLVALIDATE()]] | + | [[COPY]], [[FETCH]], [[PRINT_XML()]], [[SQL SELECT|SELECT]], [[SET XMLFORMAT]], [[SQL UPDATE|UPDATE]], [[XML]], [[XML_DECODE()]], [[XML_ENCODE()]], [[XML_GATHER()]], [[XML_SCATTER()]], [[XMLCOUNT()]], [[XMLCREATEDTD()]], [[XMLNEXT()]], [[XMLVALIDATE()]], [[XQUERY()]], [[XQUERY ATTRIBUTES()]], [[XQUERY_CLOSE()]], [[XQUERY_COUNT()]], [[XQUERY_DECODE()]], [[XQUERY_FILE()]], [[XQUERY_FIND()]], [[XQUERY_NODE()]], [[XQUERY_OPEN()]], [[XQUERY_SELECT()]] |
− | + | ||
==Description== | ==Description== | ||
The XMLFIRST() function will read the first record contained in the specified XML file, returning the number of fields in the record. | The XMLFIRST() function will read the first record contained in the specified XML file, returning the number of fields in the record. | ||
− | + | {| class="wikitable" width="100%" | |
− | {| class="wikitable" | + | !width="25%"|Parameters||Required||Default||Description |
− | !Parameters||Required||Default||Description | + | |
|- | |- | ||
− | |<XML filename>||Yes||None||The name of the XML file to read. | + | |<XML filename>||valign="top"|Yes||valign="top"|None||The name of the XML file to read. |
|- | |- | ||
− | |<memvar1>||Yes||None||The name of a memory variable that will return the XML target table name. Ignored if XMLFORMAT is ADO. | + | |valign="top"|<memvar1>||valign="top"|Yes||valign="top"|None||The name of a memory variable that will return the XML target table name. Ignored if XMLFORMAT is ADO. |
|- | |- | ||
− | |<memvar2>||Yes||None||The name of a memory variable that will return the transaction type for the record. Valid types are INSERT, UPDATE and DELETE. Ignored if XMLFORMAT is ADO. | + | |valign="top"|<memvar2>||valign="top"|Yes||valign="top"|None||The name of a memory variable that will return the transaction type for the record. Valid types are INSERT, UPDATE and DELETE. Ignored if XMLFORMAT is ADO. |
|- | |- | ||
− | |<memvar3>||Yes||None||The name of a memory variable that will return the where condition for the transaction if it is an UPDATE or DELETE type. Ignored if XMLFORMAT is ADO. | + | |valign="top"|<memvar3>||valign="top"|Yes||valign="top"|None||The name of a memory variable that will return the where condition for the transaction if it is an UPDATE or DELETE type. Ignored if XMLFORMAT is ADO. |
|- | |- | ||
− | |<array1>||Yes||None||The name of an array that will be created automatically and loaded with the field names for the record. | + | |valign="top"|<array1>||valign="top"|Yes||valign="top"|None||The name of an array that will be created automatically and loaded with the field names for the record. |
|- | |- | ||
− | |<array2>||Yes||None||The name of an array that will be created created automatically and loaded with the data for each field in the record. | + | |valign="top"|<array2>||valign="top"|Yes||valign="top"|None||The name of an array that will be created created automatically and loaded with the data for each field in the record. |
|- | |- | ||
|} | |} | ||
− | + | The XMLFIRST() function will return -1 if it fails, as some transaction type can contain zero fields. The XML file format is set to ADO (Microsoft® ActiveX® Data Objects XML Format) by default. The SET XMLFORMAT command can be used to toggle the XML file format between ADO and Lianja. | |
− | The XMLFIRST() function will return -1 if it fails, as some transaction type can contain zero fields. The XML file format is set to ADO (Microsoft® ActiveX® Data Objects XML Format) by default. The SET XMLFORMAT command can be used to toggle the XML file format between ADO and | + | |
− | + | ||
==Example== | ==Example== | ||
Line 43: | Line 37: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:XML]] | [[Category:XML]] | ||
− |
Latest revision as of 08:38, 29 February 2016
Contents
Purpose
Function to read the first record contained in the specified XML file and return the number of fields in the record
Syntax
XMLFIRST(<XML filename>, <memvar1>, <memvar2>, <memvar3>, <array1>, <array2>)
See Also
COPY, FETCH, PRINT_XML(), SELECT, SET XMLFORMAT, UPDATE, XML, XML_DECODE(), XML_ENCODE(), XML_GATHER(), XML_SCATTER(), XMLCOUNT(), XMLCREATEDTD(), XMLNEXT(), XMLVALIDATE(), XQUERY(), XQUERY ATTRIBUTES(), XQUERY_CLOSE(), XQUERY_COUNT(), XQUERY_DECODE(), XQUERY_FILE(), XQUERY_FIND(), XQUERY_NODE(), XQUERY_OPEN(), XQUERY_SELECT()
Description
The XMLFIRST() function will read the first record contained in the specified XML file, returning the number of fields in the record.
Parameters | Required | Default | Description |
---|---|---|---|
<XML filename> | Yes | None | The name of the XML file to read. |
<memvar1> | Yes | None | The name of a memory variable that will return the XML target table name. Ignored if XMLFORMAT is ADO. |
<memvar2> | Yes | None | The name of a memory variable that will return the transaction type for the record. Valid types are INSERT, UPDATE and DELETE. Ignored if XMLFORMAT is ADO. |
<memvar3> | Yes | None | The name of a memory variable that will return the where condition for the transaction if it is an UPDATE or DELETE type. Ignored if XMLFORMAT is ADO. |
<array1> | Yes | None | The name of an array that will be created automatically and loaded with the field names for the record. |
<array2> | Yes | None | The name of an array that will be created created automatically and loaded with the data for each field in the record. |
The XMLFIRST() function will return -1 if it fails, as some transaction type can contain zero fields. The XML file format is set to ADO (Microsoft® ActiveX® Data Objects XML Format) by default. The SET XMLFORMAT command can be used to toggle the XML file format between ADO and Lianja.
Example
number = xmlfirst("sales.xml", target, trans, where, names, data) ? number 30