PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → WD19 Tablesort
WD19 Tablesort
Iniciado por guest, 18,jul. 2016 17:02 - 7 respuestas
Publicado el 18,julio 2016 - 17: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 TableSort(Table_ServiceStaus,ListColumns) ELSE TableSort(Table_ServiceStaus,"COL_SerStatus_PO") END
If there are more then 1 column sorted by the user it gives error.

DW
Publicado el 18,julio 2016 - 17:49
TableSort(Table,"Col_1","Col_2")

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.

http://doc.windev.com/en-US/…
Publicado el 18,julio 2016 - 20:23
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)
Publicado el 19,julio 2016 - 18:05
Try a different way,

If I use:

TableSort(Table_ServiceStaus,"COL_SerStatus_ServiceDate","COL_SerStatus_PO")

this works

BUT If I use this it FAILS

sNames is string = "COL_SerStatus_ServiceDate","COL_SerStatus_PO" TableSort(Table_ServiceStaus,sNames)
DW
Publicado el 19,julio 2016 - 18:09
The second option is:
sNames is string = "COL_SerStatus_ServiceDate"+TAB+"COL_SerStatus_PO"
TableSort(sNames)

OR

sNames is string = "Table_ServiceStaus.COL_SerStatus_ServiceDate"+TAB+"Table_ServiceStaus.COL_SerStatus_PO"
TableSort(sNames)
Publicado el 19,julio 2016 - 18:25
Paulo,

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.

TableSort(Table_ServiceStaus,ListColumns)

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.
DW
Publicado el 20,julio 2016 - 13:17
did you try only with this?

TableSort(ListColumns)
Publicado el 20,julio 2016 - 17:46
Thank you Paulo,

That Worked!


Dennis W