ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

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
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
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> is List of arrays of int

<variable> is List of fixed arrays of 5 int

<variable> is List of associative arrays of int

<variable> is List of Queues of int

<variable> is List of Stacks of int

<variable> is List of Lists of int
Remarks

WLanguage properties that can be used with the List type

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

WLanguage functions for managing lists

The following functions can be used to handle a List variable.
AddAdds an element in last position:
  • of a one-dimensional WLanguage array.
  • of an advanced array property (array of events of gglCalendar, etc.).
  • 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 the 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: types of elements 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 MyList.Occurrence > 0 THEN
// The list may be empty when the thread reaches this point
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:
FOR EACH [ELEMENT] <Variable> [, <Counter> [, <Counter>]] OF <List> [<Direction>]
...
END
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:
    Insert(<List Name>, BeforeCurrentElement, <Value>)

    Caution: the element will be read in the next iteration in a descending loop.
  • Syntax 2:
    Insert(<List Name>, AfterCurrentElement, <Value>)

    Caution: the element will be read in the next iteration in an ascending loop.
  • Syntax 3:
    Delete(List Name, CurrentElement)

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: 01/26/2023

Send a report | Local help