Fills an array of classes or structures with the content of an HFSQL data file or query. The values of members of instances of structures or classes are filled with the values of items of records found in the data file or in the query.
// Declare a MyContacts class
MyContacts is Class
FamilyName is string
FirstName is string
EmailAddress is string
// Load records from the Contacts.fic file
// in an array of objects of MyContacts class
arrContact is array of MyContacts
FileToArray(<Array> [, <Data file> [, <Search key>]])
<Array>: Array of structures or objects
Name of one-dimensional array into which the elements found in the data file or in the query will be added. This array must be allocated in a structure or class type.
<Data file>: Character string
Name of the HFSQL data file or query used.
<Search key>: Character string
Name of search item used. This parameter is used when a filter is defined by HFilter. This parameter corresponds to the optimal search key to use, returned by HFilter.
This parameter is ignored.
- The array is entirely cleared by FileToArray.
- The automatic arrays are automatically resized according to the requirements.
- The file browse is performed by respecting the current filter on the data file.
- The position and the values of the current record are not modified by FileToArray.
- For each record found in the data file or in the query:
- for each member of structure or class with the same name, or same "mapping" attribute, as a file item, the item value is copied into the member value.
- if a structure or class member has no item with the same name in the data file, its value is not modified.
- if an item of data file has no member with the same name in the class, no copy of value will be performed.
- Caution: FileToArray is a blocking function for all the threads.