ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Queue, stack, list and array functions / Queue, stack and list functions
  • WLanguage properties that can be used with the List type
  • WLanguage functions for managing lists
  • The lists and the multithread
  • Browsing the lists
  • Special cases
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
A List variable is a structured type that is used to group a set of elements of the same type. The elements can be added at the end of the list or they can be inserted into the list.
Syntax

Declaring and initializing a list Hide the details

<List Name> is List of <Type of List Elements>
<List name>:
Name of the List variable to declare.
<Type of List Elements>:
Type of the elements found in the list.
All types of variables can be used including the arrays, the associative arrays, the queues, the stacks and the lists. For example:
<variable> est une Liste de tableaux d'entiers

<variable> est une Liste de tableaux fixes de 5 entiers

<variable> est une Liste de tableaux associatifs d'entiers

<variable> est une Liste de Files d'entiers

<variable> est une Liste de Piles d'entiers

<variable> est une Liste de Listes d'entiers
Properties

WLanguage properties that can be used with the List type

The following properties can be used to handle List variables.
Property nameEffect
Empty
  • True if the list is empty,
  • False otherwise.
OccurrenceReturns the number of occurrences of the List variable.
Remarks

WLanguage functions for managing lists

The following functions can be used to handle List variables.
AddAdds an element in last position:
  • of a one-dimensional WLanguage array.
  • of an advanced array property (array of gglCalendar events, ...).
  • from a WLanguage list.
DeleteDeletes an element at a given position:
  • from a one-dimensional WLanguage array.
  • from an advanced array property (array of gglCalendar events, etc.).
  • from an associative array.
  • from a WLanguage list.
DeleteAllDeletes all elements:
  • from a one-dimensional or two-dimensional WLanguage array.
  • from an associative array.
  • from an advanced array property (array of gglCalendar events, etc.).
  • from a WLanguage queue.
  • from a WLanguage stack.
  • from a WLanguage list.
DeserializeDeserializes a buffer or a character string containing the data from a class, structure, array (including an associative array), queue, stack, list or advanced variable, as well as their subelements.
InsertInserts an element at a given position:
  • into a one-dimensional WLanguage array.
  • into an associative array.
  • into an advanced array property (array of gglCalendar events, etc.).
  • into a WLanguage list.
ListInfoRetrieves the characteristics of a WLanguage list: element types and number of elements.
SerializeTransforms the following elements into a specific format:
  • a structure (and its subelements),
  • a class (and its subelements),
  • an array (including the associative arrays),
  • a queue,
  • a stack,
  • a list.

The lists and the multithread

The management of multithread is taken into account when adding, inserting and deleting an element.
You also have the ability to use properties during a multithread management but the result is not permanent. For example:
IF MaListe.Occurrence > 0 THEN
	// Quand le thread arrive ici, la liste peut être vide
END

Browsing the lists

The FOR EACH syntax can be used to browse the lists.
The syntax used corresponds to the one used for the arrays:
POUR TOUT [ELEMENT] <Variable> [, <Compteur> [, <Compteur>]] DE <Liste> [<Sens>]
...
FIN
The elements can be modified during the browse. If the list is modified during a browse, the browse is affected by the additions and by the deletions. The functions available during the browse are as follows:
  • Syntax 1:
    Insère(<Nom de la liste>, AvantElémentCourant, <Valeur>)

    Caution: the element will be browsed by the next iteration if the loop is descending.
  • Syntax 2:
    Insère(<Nom de la liste>, AprèsElémentCourant, <Valeur>)

    Warning: the element will be traversed by the next iteration if the loop is ascending.
  • Syntax 3:
    Supprime(<Nom de la liste>, ElémentCourant)

Special cases

  • The content of the list can be displayed in the debugger.
  • A list can be used to type a procedure parameter.
  • A list can be copied by the = operator. You also have the ability to copy an instance of class or structure containing a list.
  • A list can be initialized by a list of elements.
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/20/2024

Send a report | Local help