Promotic
WikipediaLinkedInYoutubeTwitterFacebook

GetArray - method of object PmDatabase

Description:
Creating an array or a matrix of values (of the Array type) from the selected table columns. The method reads all values from one or more table columns according to setting the vWhat parameter.
Syntax:
GetArray(sType As String, vWhat As Variant) As Array
Calling:
array = oDatabase.GetArray(sType, vWhat)
Parameters:
sType(String) Type of selected values in the table:
"col" - data from one or more table columns are returned (i.e. 1-dimensional array or matrix of data is created) depending on the value of the vWhat parameter.
"all" - All table is selected (i.e. 2-dimensional matrix is created). The vWhat value must be set to the value Empty.
vWhat(Variant) Specifies which columns values will be returned. The vWhat value must be a string, an integer or an array of integers.
If it is the string, then it is a column name or the string of column names separated by semicolon, for example, "col4;col5;col6".
If it is the integer, then vWhat>=0 means the index of the selected column (vWhat=0 means the 1.column, vWhat=-2 means the last column).
If vWhat is the array of integers, then these numbers specify indexes of table columns which data will be returned from.
"xxx" - vWhat is the string specifying either the column name, for example col4 or the string with column names separated by semicolon, for example "col4;col5;col6".
>=0 - integer >=0 means the index of the selected column (vWhat=0 means the 1.column).
-2 - Value -2 means that data from the last column are returned. If vWhat is the array of integers, then these numbers specify indexes of table columns which data will be returned from.
array - If vWhat is the array of integers (for example vWhat=Array(0,2,6)), then numbers in the array specify indexes of table columns which data will be returned from.
Note:
Using this method can take even significant long time when getting the large volume of data from comprehensive tables (tens of thousands rows,...), depending on the actual HW configuration of the computer. It is necessary to test it in this case.
Example1:
1-dimensional array that contains all values from the column with the name variable1, is assigned to arr
arr = oDatabase.GetArray("col", "variable1")
Example2:
1-dimensional array that contains all values from the third column (zero-based index), is assigned to arr
arr = oDatabase.GetArray("col", 2)
Example3:
A matrix that contains in the first row all values from the column with the name variable1 and in the second row all values from the column with the name variable1, is assigned to arr
arr = oDatabase.GetArray("col", "variable1;variable2")
Example4:
Dim cols
cols = Array(0,1,2)
arr = oDatabase.GetArray("col", cols)
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice