ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Queue, stack, list and array functions / Array functions
  • Adding a row to a WLanguage array
  • Adding a row to an advanced array property
  • Miscellaneous
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Adds a row at the end:
  • of a one- or two-dimensional WLanguage array.
  • of an advanced two-dimensional array property (xlsDocument, etc.).
Example
MyArray is array of 2 by 3 strings
MyArray.AddLine("A", "B", "C")
MyArray.AddLine("a", "b", "c")
MyArray.AddLine("D", "E", "F")
// Display the content of the 3rd row (the two first rows are empty)
Trace(MyArray[3,1], MyArray[3,2], MyArray[3,3])
// Displays "A B C"
MyArray is array of 2 by 3 strings
MyArray[1,1] = "A"
MyArray[1,2] = "B"
MyArray[1,3] = "C"
MyArray[2,1] = "a"
MyArray[2,2] = "b"
MyArray[2,3] = "c"
MyArray.AddLine("D", "E", "F")
// Display the content of the 3rd row
Trace(MyArray[3,1], MyArray[3,2], MyArray[3,3])
// Displays "D E F"
Syntax
<Result> = <WLanguage array>.AddLine([<Element column 1> [... [, <Element column N>]]])
<Result>: Integer
  • Index of the added row,
  • -1 if an error occurred.
<WLanguage array>: Array
Name of the Array variable to use. This array must be a one-dimensional array or a two-dimensional array.
<Element column 1>: Type of array elements, optional
Element of the row that will be added into the specified array. Each element corresponds to a column in the array. The type of the added element must be compatible with the type of relevant column.
If none of these parameters is specified, an empty row is added to the array. The columns are initialized with the default value of the type of the other array elements.
If one of these parameters is not specified, the corresponding column is initialized with the default value of the type of the other array elements.
<Element column N>: Type of array elements, optional
Element of the row that will be added into the specified array. Each element corresponds to a column in the array. The type of the added element must be compatible with the type of relevant column.
If none of these parameters is specified, an empty row is added to the array. The columns are initialized with the default value of the type of the other array elements.
If one of these parameters is not specified, the corresponding column is initialized with the default value of the type of the other array elements.
Remarks

Adding a row to a WLanguage array

When <Array>.AddLine is called:
  • the number of rows in the array is automatically increased to include the new row.
  • the number of columns in the array is not increased. You must:
    • declare the array with the proper number of columns (second dimension of the array).
    • dynamically modify the number of columns with Dimension.
  • the elements are converted (if necessary) into the type of the other array elements.
Remark: When declaring an array of N by M elements, this array contains N empty rows. For example, the array declared below contains 3 empty rows.
MyArray is array of 3 by 2 strings
Rows added using <Array>.AddLine are automatically added after the existing rows in the array.
In our example, the added row corresponds to the 4th row.

Adding a row to an advanced array property

When <Array>.AddLine is called:
  • the advanced variable must be created.
  • the advanced type must have an enumerator of modifiable collection type.
  • the advanced type is automatically enlarged to receive the new row.

Miscellaneous

  • This function cannot be used on:
    • non-created arrays.
    • fixed arrays.
Component: wd290vm.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help