Automatically initializes the values of the members found in a class or in a structure with the values of the items of the current record found in a data file.
You also have the ability to initialize the values of advanced members from the values of items of the current record in a data file.
does not read records on the data file. The value of the record loaded in memory is used to initialize the values of the members. Therefore, a record must be loaded in memory previously (with HRead
In WEBDEV, you also have the ability to use FileToPage
FileToMemory(<Name of instance of structure or class> , <File name>)
<Name of instance of structure or class>: Structure or Class variable
Name of the instance of the class or structure in which the members must be initialized with the values of the current record in the data file. The name of class or structure variable must be specified.
Remark: If this function is called in a class instance, the "object" keyword must be used to retrieve the current instance.
<File name>: Character string
Name of the data file to which the linked items belong.
- If a member of the structure or class is named like an item of the HFSQL data file, the value of the item in memory is copied into the value of the member. The name of the member must contain no prefix. The case and the accented characters are ignored when comparing the name of items and the names of members.
- If a member of the structure or class has no item with the same name in the HFSQL data file, its value is not modified. You can use VariableReset to initialize the value of the members before the call to FileToMemory.
Array items of the data file: change of behavior
- In version 15, if the WLanguage array contained N elements (N being less than the size of the array of HFSQL), FileToMemory copied the first N elements of the Array item from the HFSQL data file. The WLanguage array was not enlarged.
- From version 16, at the end of the operation, the WLanguage array and the array of HFSQL data files contain the same number of elements.