Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 8 Monaten
Letzter Beitrag:
vor 1 Jahr, 8 Monaten
Beteiligte Autoren:
DW, Paulo Oliveira, Stefan Bentvelsen

WD19 Tablesort

Startbeitrag von DW am 18.07.2016 15:02

Hello All,

I have a table filled by programing. I use tablesort to sort on a column.

Problem when using multi columns I get error the the columns are not part of the table.

Ex : TableSort(Table,"Col_1"+tab+"Col_2") will give an error.

If I do TableSort(Table,"Col_1") it works fine.

More Detail:
I use this code to see what sorts the user has selected

//See if there are an sorts
ListColumns is string = TableSortedColumn(Table_ServiceStaus)

then follow it up with after the table is reloaded.

IF ListColumns "" THEN

If there are more then 1 column sorted by the user it gives error.




if separated by TAB don't put the the table name in the first parameter, check the sintax in the help in the section Sorting a Table or TreeView Table control according to a list of column names.


von Paulo Oliveira - am 18.07.2016 15:49
Hi DW,

I use TableSort(MyTable,Col_1..name,Col_2..name,Col_x..name) and it works as a charm.
You can also put a minus sign before a column, i.e. to sort decending on Col_2:
TableSort(MyTable,Col_1..name,"-" + Col_2..name,Col_x..name)

von Stefan Bentvelsen - am 18.07.2016 18:23
Try a different way,

If I use:


this works

BUT If I use this it FAILS

sNames is string = "COL_SerStatus_ServiceDate","COL_SerStatus_PO"


von DW - am 19.07.2016 16:05
The second option is:
sNames is string = "COL_SerStatus_ServiceDate"+TAB+"COL_SerStatus_PO"


sNames is string = "Table_ServiceStaus.COL_SerStatus_ServiceDate"+TAB+"Table_ServiceStaus.COL_SerStatus_PO"

von Paulo Oliveira - am 19.07.2016 16:09

Same result if I try to use a variable to pass to tablesort it fails. If you do it manually it works.

I am try to reproduce the sort that the end user selected when they clicked the table column sort icons, when the table is reloaded new with records.

ListColumns is string = TableSortedColumn(Table_ServiceStaus) gives you a list of columns that where sorted if you try to use that same varible for table sort and more then 1 column was selected it fails.


I think this is a bug and trying to see if anyone else has come across this so I can report it to PC soft or I am missing something.

von DW - am 19.07.2016 16:25
did you try only with this?


von Paulo Oliveira - am 20.07.2016 11:17
Thank you Paulo,

That Worked!

Dennis W

von DW - am 20.07.2016 15:46
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.