PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Adding an element into a WLanguage 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)
  • Adding the content of a structure to an array of structures without using a variable of the structure
  • Use conditions
  • Various
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 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, etc.).
  • from a WLanguage list.
This function can also be used to concatenate two arrays or two lists.
Remarks:
  • This function is equivalent to ArrayAdd.
  • WEBDEV - Browser codePHP This function can only be used with Array variables.
Versions 16 and later
Java This function is now available for Java applications.
PHP This function is now available for PHP sites.
Android This function is now available for Android applications.
New in version 16
Java This function is now available for Java applications.
PHP This function is now available for PHP sites.
Android This function is now available for Android applications.
Java This function is now available for Java applications.
PHP This function is now available for PHP sites.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android widget mode.
New in version 18
Android Widget This function is now available in Android widget mode.
Android Widget This function is now available in Android widget 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.
AndroidAndroid Widget Java This function is now available for List variables.
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.
AndroidAndroid Widget Java This function is now available for List variables.
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.
AndroidAndroid Widget Java This function is now available for List variables.
Example
MonTableau is array of 2 strings
Add(MonTableau, "WINDEV")
Add(MonTableau, " WEBDEV")
Add(MonTableau, "WINDEV et WEBDEV")
// Afficher le contenu du 3° élément (les deux premiers sont vides)
Trace(MonTableau[3])  // Affiche "WINDEV"
MonTableau is array of 2 strings
MonTableau[1] = "WINDEV"
MonTableau[2] = "WEBDEV"
Add(MonTableau, "WINDEV et WEBDEV")
// Afficher le contenu du 3° élément
Trace(MonTableau[3]) // Affiche "WINDEV et WEBDEV"
WINDEVWEBDEV - Server codeLinuxAndroidiPhone/iPadIOS WidgetMac CatalystJavaAjax
// Exemple d'ajout d'un élément dans un fichier XML
NoeudRSS is xmlNode,description="NEWS.rss.channel.item"
NoeudRSS.title = DateToString(DateSys(), "JJ/MM/AAAA") + " - " + ...
TimeToString(TimeSys(), "HH:MM") + ": " + sTitre
NoeudRSS.description = sCommentaire
NoeudRSS.link = sLienHTTP
NoeudRSS.enclosure:type = "image/jpeg"
NoeudRSS.enclosure:length = 150
NoeudRSS.enclosure:url = sURL_Image
 
Add(MonDocXML.rss.channel, NoeudRSS)
XMLSave(MonDocXML, gsCheminFichierXML)
Syntax

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

<Result> = Add(<WLanguage variable> [, <Value>])
<Result>: Integer
Index at which the specified element was added. If an error occurs, a fatal error is displayed.
<WLanguage variable>: Array or List
Name of variable to use. This variable can be:
  • An Array variable.
  • 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> = Add(<WLanguage variable> [, <Variable to concatenate>])
<Result>: Integer
Index at which the specified element was added. If an error occurs, a fatal error is displayed.
<WLanguage variable>: Array or List
Name of variable to use. This variable can be:
  • An Array variable.
  • A List variable.
    WEBDEV - Browser codePHP This type of variable is not available.
<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.
  • A List variable, to concatenate two lists.
    WEBDEV - Browser codePHP This type of variable is not available.
Remarks

Adding an element into a WLanguage array

When using the Add function:
  • the array is automatically enlarged to receive the new element.
  • the element is 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 elements. For example, the array declared below contains 3 empty strings.
MonTableau est un tableau de 3 chaînes
When adding an element (Add), 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 the Add function:
  • 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 elements.
  • the element is initialized with the value passed as 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 the Add function:
  • 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 the Add function:
  • the array is automatically resized to receive the new elements. The elements of <Name of variable to concatenate> are added at the end of <Variable name>.
  • the two arrays must have the same type.
  • the arrays must have the same dimension.
  • the array dimensions (other than the first dimension) must be identical.
    For example:
    Correct code:
    t1 is array of * by 2 int = [[1,2],[3,4]]
    t2 is array of * by 2 int = [[5,6],[7,8],[9,10]]
    Add(t1, t2)
    Incorrect code:
    t1 is array of * by 3 int = [[1,2],[3,4]]
    t2 is array of * by 2 int = [[5,6],[7,8],[9,10]]
    Add(t1, t2)

Adding a list into a list (concatenation)

When using the Add function:
  • 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.

Adding the content of a structure to an array of structures without using a variable of the structure

If you are using an array of structures with few members, it may be easier to directly add a structure by using the [ ] operator (square brackets). For example, for the following structure:
// Structure pour mémoriser une lettre et son code ASCII
STTouche est une Structure
sTouche est une chaîne
nCodeAscii est un entier
FIN
// Tableau de structures
tabTouches est un tableau de STTouche
In most cases, content is added by using a variable of a type declared in the structure:
// Structure temporaire pour l'ajout
stUneTouche is STTouche
// Mémorise la lettre A
stUneTouche.sTouche = "A"
stUneTouche.nCodeAscii = Asc("A")
Add(tabTouches, stUneTouche)
With the [ ] operator, you get better legibility:
// Mémorise la lettre A
Add(tabTouches, ["A", Asc("A")])

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 as parameter to Add.
This function cannot be used on:
  • non-created arrays.
  • fixed arrays.

Various

Component: wd270vm.dll
Minimum version required
  • Version 14
This page is also available for…
Comments
Example result com 2 array
BuscaFoto(ID_ORIGEM)

ID_Unico_Foto is 8-bytes int
FotoLocalizada is Buffer

IF HExecuteQuery(QRY_Fotos,CONNX,hQueryDefault,ID_ORIGEM) = True THEN

FOR EACH QRY_Fotos

ID_Unico_Foto = QRY_Fotos.T002_ARQUIVOSID
FotoLocalizada = QRY_Fotos.T002_ARQUIVO

END

END

arresultado is array of Variant ///IMPORTANTE

Add(arresultado,ID_Unico_Foto)
Add(arresultado,FotoLocalizada)

RESULT arresultado

//------- USE:

ArrResult is array of variant = BuscaFoto(1)
EDT_CodigoImagem = ArrResult[1]
IMG_Foto = ArrResult[2]
BOLLER
17 Apr. 2019