Welcome! Log In Create A New Profile

Advanced

WD24 - Sorting in tables.

Posted by AadG 
WD24 - Sorting in tables.
May 08, 2020 11:18AM
Hi all,

I have a question about sorting in tables. I have a table with a alfanumeric column, that I want to sort in a different way as it happens now.
When I use Direct access access the column is sorted in the first way and when I use Loaded in memory the column is sorted in the second way. This is the one I need. Does anybody know why this is and can example one be sorted in the second way with Direct access.

Thanks for any help.

Regards,

Aad

Column needs to accept numbers and letters.

Direct access
1
10
100
101
102 etc

Loaded in memory
1
2
3
4
5 etc
Re: WD24 - Sorting in tables.
May 08, 2020 12:29PM
Hi Aad,

if customer wants a correct sorting

1 - Data has to be in UniCode (because of the Umlauts, probably not your problem)

2 - I can right-align the column using leading spaces

If 15 is the length of the field then

MyString = RepeatString(15 - Length(Nospace(MyString), " ") + Nospace(MyString)

Maybe, even a right alignment of the table's column is sufficient .. never tried that

Kind regards,
Guenter Predl
office@windev.at
Re: WD24 - Sorting in tables.
May 08, 2020 01:06PM
Hi Guenter,

Thanks for you reply. I thnk my post is not clear. I'm not talking but allignment, but the sorting itself.
Sorting needs to be as in my Loaded in memory example.

a1
a13
b5
c1

Now I get

1
10
100
101
102
103
104
105
106
107
108
109
11
110
111 this sorting is not OK.

So the column can exist of numbers only, the sort has to be like a numeric column, but like above it can also be
a combination of alfanumeric and numbers.

I remember from earlier days, that in Windev sorting can be altered on alfanumeric or numbers or both. I can't find
in the Help though.

Best regards,

Aad
Re: WD24 - Sorting in tables.
May 08, 2020 01:20PM
Hi Aad,

of course, of course ... spaces are shown as _

____1
---110
----10

sorted will show

-----1
----10
---110

Kind regards,
Guenter Predl
office@windev.at
Al
Re: WD24 - Sorting in tables.
May 08, 2020 03:20PM
Hello Add

Make sure the table is a memory table and then you can set the sort order options for a column.

At the bottom of the General tab for each column, there is a "Sortable" tick box. To the right of that is an "Options" button that allows you to customize the sort. When you tick that option, the defaults will apply and they will actually do what you are asking for without making any other changes.

Regards
Al
Re: WD24 - Sorting in tables.
May 08, 2020 03:27PM
Thanks Al,

This is exactly what I was looking for like I mentioned earlier. I knew I have seen it somewhere.
It's woking OK know.

Thanks again.

Best regards,

Aad
Re: WD24 - Sorting in tables.
May 09, 2020 02:09AM
I have the same problem but with a Looper (controlled programatically). The attribute I sort on is filled with an integer, and I use

LooperSort("LOOP_Residents_Grid.ATT_Room_Number")

and it sorts

1
10
11
2
21

etc

Any ideas?
Re: WD24 - Sorting in tables.
May 12, 2020 10:49AM
Hi,

Try with: LooperSort(Val("LOOP_Residents_Grid.ATT_Room_Number"))

Regards

Vassilis Boutsikas
Re: WD24 - Sorting in tables.
May 13, 2020 03:19AM
Nice idea, but unfortunately crashes on device
Al
Re: WD24 - Sorting in tables.
May 13, 2020 03:28AM
Hello Pauly

You mention that you are adding integers to the field but the field seems like it is configured as text for it to sort as you display.
If the field is configured as numeric, it must sort correctly as 1,2,10,11,21

If it is text then could consider Guenter's suggestion to pad it with spaces on the left side

Regards
Al
Re: WD24 - Sorting in tables.
May 13, 2020 09:17AM
Hi Pauly,

If ommit the double quotes ?
LooperSort(Val(LOOP_Residents_Grid.ATT_Room_Number))

Regards

Vassilis
Re: WD24 - Sorting in tables.
May 13, 2020 12:19PM
Hi

Thanks for the continued suggestions. Syntax requires double quotes.

I forgot to mention this is a WM25 project, which may be the problem. If I load into an array first, sort the array, and then load into the looper I can work around the problem. So far no other solution presents itself.

Rgds
Paul
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: