PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Adding an element into an array
  • Adding an element into an advanced array property
  • Adding an element into a list
  • Adding an array into an array (concatenation)
  • Adding a list into a list (concatenation)
  • Use conditions
  • Various
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Adds an element in last position:
  • of a one-dimensional WLanguage array.
  • of an advanced array property (array of gglCalendar events, array of Word Processing document, ...).
  • of a WLanguage list.
This function can also be used to concatenate two arrays or two lists.
Notes:
  • This function is equivalent to Add.
  • WEBDEV - Browser codePHP This function can only be used with the Array variables.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
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.
WEBDEV - Browser code This function is now available in browser code.
New in version 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.
WEBDEV - Browser code This function is now available in browser code.
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.
WEBDEV - Browser code This function is now available in browser code.
Example
MyArray is array of 2 strings
ArrayAdd(MyArray, "WINDEV")
ArrayAdd(MyArray, " WEBDEV")
ArrayAdd(MyArray, "WINDEV and WEBDEV")
// Display the content of 3rd element (the first 2 elements are empty)
Trace(MyArray[3])  // Displays "WINDEV"
MyArray is array of 2 strings
MyArray[1] = "WINDEV"
MyArray[2] = "WEBDEV"
ArrayAdd(MyArray, "WINDEV and WEBDEV")
// Display the content of 3th element
Trace(MyArray[3]) // Displays "WINDEV and WEBDEV"
Syntax

Adding an element to an array, to an advanced array property or to a list Hide the details

<Result> = ArrayAdd(<Variable Name> [, <Value>])
<Result>: Integer
Subscript at which the specified element was added. If an error occurs, a fatal error is displayed.
<Variable Name>: Array or List
Name of variable to use. This variable can be:
  • An Array variable. This array must be a one-dimensional array.
  • A List variable.
    WEBDEV - Browser codePHP This type of variable is not available.
<Value>: Type of array elements, optional
Value that will be added to the array or to the list. This parameter is mandatory for a list.
For an array, if this parameter is not specified, the array is enlarged with the default value of the type of the other array elements.

Concatenating arrays or lists Hide the details

<Result> = ArrayAdd(<Variable Name> [, <Name of Variable to Concatenate>])
<Result>: Integer
Subscript at which the specified element was added. If an error occurs, a fatal error is displayed.
<Variable Name>: Array or List
Name of variable to use. This variable can be:
  • An Array variable. This array must be a one-dimensional array.
  • A List variable.
    WEBDEV - Browser codePHP This type of variable is not available.
<Name of Variable to Concatenate>: Optional array or list
Name of variable that will be added after the existing elements. This variable can be:
  • An Array variable, to concatenate two arrays. This array must be a one-dimensional array.
  • A List variable, to concatenate two lists.
    WEBDEV - Browser codePHP This type of variable is not available.
Remarks

Adding an element into an array

When using ArrayAdd:
  • the array is automatically enlarged to receive the new element.
  • the element is converted (if necessary) into the type of the other array elements.
Note: When declaring an array of N by M elements, this array contains N empty elements. For example, the array declared below contains 3 empty strings.
MyArray is array of 3 strings
When adding an element (ArrayAdd), this element is automatically added after the elements already found in the array.
In our example, the added element will correspond to the 4th element.

Adding an element into an advanced array property

When using ArrayAdd:
  • the advanced variable must be allocated.
  • the advanced type must have an enumerator of modifiable collection type.
  • the advanced type is automatically enlarged to receive the new elements.
  • the element is initialized with the value passed in parameter. If no value is passed in parameter, the element is initialized with the default value of the type of the array elements.

Adding an element into a list

When using ArrayAdd:
  • the list is automatically enlarged to receive the new element.
  • the element is converted (if necessary) into the type of the other list elements.
WEBDEV - Browser codePHP This feature is not available.

Adding an array into an array (concatenation)

When using ArrayAdd:
  • the array is automatically resized to receive the new elements. The elements of <Name of Array to Concatenate> are added at the end of <Array Name>.
  • the two arrays must have the same type.
  • the arrays must have the same dimension.
  • the values of array dimensions (except for the first one) must be identical.

Adding a list into a list (concatenation)

When using ArrayAdd:
  • the list is automatically enlarged to receive the new elements. The elements of <Name of Variable to Concatenate> are added at the end of <Variable Name>.
  • the two lists must have the same type.
WEBDEV - Browser codePHP This feature is not available.

Use conditions

This function can be used with the structures. In this case, you must:
  1. Declare a variable (same type as the structure).
  2. Initialize each member.
  3. Pass the structure variable in parameter to ArrayAdd.
This function cannot be used on:
  • the non-allocated arrays.
  • the fixed arrays.

Various

Components
WINDEVWEBDEV - Server codeReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230vm.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment