|
|
|
|
|
- Use conditions
- Sorting a Table or TreeView Table control based on a data file
- Managing a sorted Table or TreeView Table control
- Sort on a calculated column
- Programmatically loop through Table or TreeView Table controls
- Performing a sort according to the ASCII value
<Table>.Sort (Function) In french: <Table>.Trie Sorts a Table or TreeView Table control on one or more columns (lexicographical sort). Note: When a field is sorted using the <Table>.Sortfunction, the images used to identify the sorting direction are not displayed in the columns..
TABLE_Produit.Trie("COL_Désignation", "-COL_Prix")
Syntax
Sorting a Table or TreeView Table control on one or more columns identified by their name Hide the details
<Result> = <Table control>.Sort(<Column 1> [, <Column 2> [... [, <Column N>]]])
<Result>: Boolean - True if the sort was performed,
- False otherwise.
<Table control>: Control name Name of the control to be used. This control can correspond to: - a Table control.
- a TreeView Table control.
<Column 1>: Character string Name of first column to sort (up to 16 columns). This parameter has the following format:
"[<Sens>]<Nom de la colonne>" where:- <Direction> (character) indicates the sort direction:
- "+": ascending sorting (default),
- "-": sorting in descending order.
- <Nom de la colonne> (string): name of column to sort.
<Column 2>: Optional character string Name of the second column to sort (up to 16 columns). This parameter has the following format:
"[<Sens>]<Nom de la colonne>" where:- <Direction> (character) indicates the sort direction:
- "+": ascending sorting (default),
- "-": sorting in descending order.
- <Nom de la colonne> (string): name of column to sort.
<Column N>: Optional character string Name of Nth column to sort (up to 16 columns). This parameter has the following format:
"[<Sens>]<Nom de la colonne>" where:- <Direction> (character) indicates the sort direction:
- "+": ascending sorting (default),
- "-": sorting in descending order.
- <Nom de la colonne> (string): name of column to sort.
Canceling a sort that was previously defined on a Table or TreeView Table control populated programmatically Hide the details
<Result> = <Table control>.Sort(<False>)
<Result>: Boolean - True if the sort was canceled,
- False if a problem occurred.
<Table control>: Control name Name of the control to be used. This control can correspond to: - a Table control populated programmatically.
- a TreeView Table control populated programmatically.
<False>: Constant False: Keyword used to cancel a previously defined sort on a table or hierarchical table field by programming.. Remarks Use conditions <Table>.Sort can be used on: - Table or TreeView Table controls populated programmatically.
- a Table or TreeView Table control based on a data file with automatic iteration ("Browse automatically" option in the "Content" tab of the control description). In this case, only one column is sorted.
- single-selection or multi-selection controls.
Reminder: Multi-selection is not available for Table fields in Classic mode.
Sorting a Table or TreeView Table control based on a data file A Table or TreeView Table control based on a data file will be sorted according to the first specified column (syntax 1 and 2). Warning: the column used for sorting must be linked to a key item in the data file used to browse the field. Tip: To sort a Table or hierarchical Table file with multiple columns, use a compound key and the BrowsedItem property: NomTable..RubriqueParcourue = NOMCLECOMPOSEE To cancel a sort in a Table or TreeView Table control based on a data file, simply assign an empty string to the BrowsedItem property. Managing a sorted Table or TreeView Table control - When the control is sorted by <Table>.Sort, the additions performed by <Table>.Add, <Table>.AddLine, <Table>.Insert and <Table>.InsertLine take the sort into account.
- When the control is sorted by a mouse click, the additions performed by <Table>.Add, <Table>.AddLine, <Table>.Insert and <Table>.InsertLine ignore the sort.
- The sort is not canceled by <Table>.Display, <Table>.Adjust, TableSearch, <Table>.Count, <Table>.Position, <Table>.Select, <Table>.SelectMinus, <Table>.SelectPlus, <Table>.Delete and <Table>.DeleteAll.
- The sort is canceled if a column is modified (by direct input in the column or by <Table>.Modify and <Table>.ModifyLine) and if it is sorted.
Sort on a calculated column It is not recommended to use <Table>.Sort on calculated columns. These columns are calculated when each row is displayed. A sort defined with <Table>.Sort on a calculated column will be valid only for the rows already displayed. Programmatically loop through Table or TreeView Table controls <Table>.Sort has no effect on controls looped through programmatically. Performing a sort according to the ASCII value A memory area allows you to perform a sort according to the ASCII value Example:
MemCreate("ZM")
MemAdd("ZM", "abc", "abc")
MemAdd("ZM", "ZZZ", "ZZZ")
MemAdd("ZM", "zbc", "zbc")
MemAdd("ZM", "ééébc", "ééébc")
MemAdd("ZM", "AB", "AB")
MemAdd("ZM", "CD", "CD")
MemAdd("ZM", "çabc", "çabc")
MemAdd("ZM", "bbc", "bbc")
MemSort("ZM")
i is int
MemFirst("ZM")
WHILE NOT MemOut("ZM")
i = MemCurrent("ZM")
Trace(MemRetrieve("ZM", i))
MemNext("ZM")
END
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|