PC SOFT

AYUDA EN LÍNEA
DE WINDEV, WEBDEV Y WINDEV MOBILE

WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Otros
Procedimientos almacenados
FileToArray (Function)
 
Fills an array of classes or structures with the content of a 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.
Versiones 16 y posteriores
PHP This function is now available for the PHP sites.
Nueva funcionalidad versión 16
PHP This function is now available for the PHP sites.
PHP This function is now available for the PHP sites.
Versiones 18 y posteriores
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Nueva funcionalidad versión 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
señalar: A partir de la versión 19, HFSQL es el nuevo nombre de HyperFileSQL.
Versiones 21 y posteriores
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Nueva funcionalidad versión 21
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versiones 23 y posteriores
Java This function is now available for the Java applications.
Widget Android This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Nueva funcionalidad versión 23
Java This function is now available for the Java applications.
Widget Android This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
Widget Android This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Ejemplo
// Declare a MyContacts class
MyContacts is Class
FamilyName is string
FirstName is string
EmailAddress is string
END

// Load the records found in a CONTACTS.FIC file
// in an array of objects of MyContacts class
arrContact is array of MyContacts

HOpen(CONTACTS)
FileToArray(arrContact, CONTACTS)
Sintaxis
FileToArray(<Array> [, <File Name> [, <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.
<File Name>: Character string (with or without quotes)
Name of the HFSQL data file or query used.
<Search Key>: Character string (with or without quotes)
Versiones 16 y posteriores
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.
PHP This parameter is ignored.
Nueva funcionalidad versión 16
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.
PHP This parameter is ignored.
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.
PHP This parameter is ignored.
Observaciones
  • 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. AndroidWidget Android Java The "mapping" attribute is not available.
    • 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 locking function for all the threads.
Componente : wd240vm.dll
Versión mínima requerida
  • Versión 15
Esta página también está disponible para…
Comentarios
HFILER DICA
O filetoarray se não tiver antes dele um hfilter coloca no array a tabela inteira e se colocar o hfilter, traz só o registro. exemplos:

//assim vai trazer só o registro atual
HFilter(RADFileA,RADFileA.IDRADFileA,gnID)
FileToArray(garr_RADFileA_Depois,RADFileA,RADFileA.IDRADFileA)

//vai trazer todos os registros
FileToArray(garr_RADFileA_Depois,RADFileA,RADFileA.IDRADFileA)

DICA:
Voce pode atribuir uma Classe de um arquivo a um array assim:

garr_RADFileA_Antes is array of CMRADFileA
garr_RADFileA_Depois is array of CMRADFileA
BOLLER
24 02 2019
Suggestion on LIMITATION: Missing Auto assignments on subclass members
PeHoBe,

What if you program the "Property Setter" of the CityID property of the CustomerClass to do the creation of the CityClass when the CityId is specified.

Then it should happen automatically as values are assigned to the properties
SteveH
07 03 2012
LIMITATION: Missing auto assignment on subclass members
This function works great but is missing one neat feature, the assignment towards members of subclasses (Typically useful when implementing a Model-View-Controller architecture).

Here's a simplified example:
1) Classes used
Class CustomerClass
CustomerID is int
Name is string
CityID is int
City is a CityClass
END

Class CityClass
CityID is int
CityName is string
PostalCode is string
CountryID is int
Country is CountryClass
END

Class CountryClass
CountryID is int
CountryISOCode is string
CountryName is string
END

2) Query used to assign to class members
Assume we have a query that joins customers with the city table and the country table resulting in a data source with the format:
CustomerID | Name | CityID | CityName | PostalCode | CountryID | CountryISOCode | CountryName

3) Array used
MyArray is array of 0 CustomerClass

4) Now we assign this query result to the array of CustomerClass objects using the FichierVersTableau(MyArray, MyQuery) function. This would unfortunately only assign the members at the level of the Customer Class instance and not the members of the subclass City instance and the subsubclass Country instance limitating this feature in real life OO scenario's.
PeHoBe
18 08 2010