ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Looper functions
  • Use conditions
  • Canceling the sort
  • Sort
  • Looper bound to a data source and using a programmed iteration
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
LooperSort (Function)
In french: ZoneRépétéeTrie
Allows you to:
  • Sort a Looper control according to one or more attributes.
  • Sort a Looper control on all its attributes.
  • Cancel a sort that was performed beforehand (which means ignore the sort).
Example
// Sort according to one of the Looper control attributes selected in a Radio Button control
SWITCH RADIO_RADIO1
CASE 1: LooperSort("NAME")
CASE 2: LooperSort("COMPANY")
CASE 3: LooperSort("CITY")
END
// Sort by name (in ascending order) and by date (in descending order)
LooperSort("NAME" + TAB + "-DATE")
// Tri du champ Zone répétée ZR_Client par ordre décroissant sur tous ses attributs
LooperSort("-ZR_Client")
// Annule le tri précédemment effectué sur le champ Zone répétée ZR_Client
LooperSort("ZR_Client", False)
Syntax

Sorting a Looper control according to a list of attributes Hide the details

<Result> = LooperSort(<List of attributes>)
<Result>: Boolean
  • True if the sort was performed,
  • False otherwise.
<List of attributes>: Character string
Name of the attributes according to which the Looper control will be sorted (up to 10 attributes). This character string must have the following format:
"[<Sens>]<Attribut 1>" + TAB + "[<Sens>]<Attribut 2>" + TAB + ...
where:
  • <Direction>: sort direction (optional), can take the following values:
    • "+": the sort will be performed in ascending order (default value).
    • "-": the sort will be performed in descending order.
  • <Attribute>: name of the attribute used for the sort.
WEBDEV - Browser code In browser code, the sort can be performed on a single attribute only.

Sorting a Looper control or canceling a previous sort Hide the details

<Result> = LooperSort([<Direction>]<Looper> [, <Indicator>])
<Result>: Boolean
  • True if the sort was performed or canceled,
  • False otherwise.
<[<Direction>]<Looper>>: Character string
Name of the Looper control to sort.
  • If <Direction> is equal to "+", the Looper control will be sorted in ascending order (by default).
  • If <Direction> is equal to "-", the Looper control will be sorted in descending order.
<Indicator>: Optional boolean
  • True to perform the sort (default value),
  • False to cancel a sort that was performed beforehand.
Remarks

Use conditions

LooperSort can be used on:
  • a Looper control based on a data file,
  • a Looper control populated programmatically.
WEBDEV - Browser code This function is not available for Linear Looper controls. This function is available for Looper controls in browser mode only.
WEBDEV - Server codePHP This function is available for Looper controls in Ajax mode, Looper controls in classic mode and Linear Looper controls.

Canceling the sort

Sort

The sort will be taken into account during the next addition of a row into the Looper control (LooperAdd, LooperAddLine, LooperInsert and LooperInsertLine).

Looper bound to a data source and using a programmed iteration

LooperSort does not work on a Looper control with the following characteristics:
  • Looper control bound to a data source,
  • Looper control that uses Browse programmatically ("Content" tab in the control description window).
To change the display order of a Looper control with programmed browse, you must adapt the code found in the different read processes of the Looper control (process for reading the first one, the next one, the previous one, ...).
Component: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 01/09/2024

Send a report | Local help