PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Deleting the last element
  • Miscellaneous
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
Deletes 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.
  • into a WLanguage list.
The array size is automatically reduced.
Notes:
Example
MyArray is array of 2 strings
MyArray[1] = "WINDEV"
MyArray[2] = "WEBDEV"
// Delete the 1st element
MyArray.Delete(1) // Deletes "WINDEV"
// Display the 1st element
MyArray.Trace([1])  // Displays "WEBDEV"
 
// Associative array Last Name - First Name
aaLastNameFirstName is associative array of strings
aaLastNameFirstName.Insert("Smith", "Tommy")
aaLastNameFirstName.Insert("Montgomery", "Julia")
aaLastNameFirstName.Delete("Moulin")
// Deletion during a browse
sLastName is string
sFirstName is string
FOR EACH ELEMENT sFirstName, sLastName OF aaLastNameFirstName
Trace(sFirstName + ":" + sLastName)
aaLastNameFirstName.Delete(CurrentElement)
END
 
Syntax

Deleting an element from a WLanguage array or from an advanced array property Hide the details

<Result> = <WLanguage array>.Delete(<Element subscript>)
<Result>: Integer
Number of deleted elements (always corresponds to 1).
<WLanguage array>: Array
Name of Array variable to use. This array must be a one-dimensional array.
<Element subscript>: Integer
  • Subscript of element to delete. A WLanguage error occurs if this parameter is greater than the number of array elements.
  • Versions 17 and later
    The following constants can be used:
    FirstElementThe first array element is deleted.
    CurrentElementThe current element is deleted. This constant is used to delete the current element during a FOR EACH browse.
    This constant is only available for associative arrays.
    New in version 17
    The following constants can be used:
    FirstElementThe first array element is deleted.
    CurrentElementThe current element is deleted. This constant is used to delete the current element during a FOR EACH browse.
    This constant is only available for associative arrays.
    The following constants can be used:
    FirstElementThe first array element is deleted.
    CurrentElementThe current element is deleted. This constant is used to delete the current element during a FOR EACH browse.
    This constant is only available for associative arrays.

Deleting an element from an associative array Hide the details

<Result> = <WLanguage array>.Delete(<Element key>)
<Result>: Integer
Number of deleted elements:
  • 1 or 0 for the associative arrays without duplicates.
  • 0 to N for the associative arrays with duplicates.
<WLanguage array>: Associative array
Name of Associative Array variable to use.
<Element key>: Integer
  • Value of key corresponding to the element to delete.
    • In an associative array without duplicate: If the element exists, it is deleted ; if the element does not exist, no operation is performed.
    • In an associative array with duplicates: If the element exists, all the <Element Key> elements are deleted ; if the element does not exist, no operation is performed.
  • This parameter can also correspond to the CurrentElement constant. This syntax is used to delete the current element during a FOR EACH browse.
Remarks

Deleting the last element

If the last element is deleted, the array is resized to 0. The array has not been deleted: new additions can be performed without re-creating the array.

Miscellaneous

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