After getting data from MySQL, how to make the data sequence
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
After getting data from MySQL, how to make the data sequence
For example,
Table:
Time
0900
1000
0800
0700
I want it to look like :
Time
0700
0800
0900
1000
when the data shows in the field.
How to make that happen in LiveCode?
Thanks!!
Michael
Table:
Time
0900
1000
0800
0700
I want it to look like :
Time
0700
0800
0900
1000
when the data shows in the field.
How to make that happen in LiveCode?
Thanks!!
Michael
Re: After getting data from MySQL, how to make the data sequ
Hi.
Just sort the data following the title:
sort yourData numeric.
I assume you can separate the two portions of the returned data. I also assume there is more to this than I think.
Craig Newman
Just sort the data following the title:
sort yourData numeric.
I assume you can separate the two portions of the returned data. I also assume there is more to this than I think.
Craig Newman
Re: After getting data from MySQL, how to make the data sequ
Great, Craig, thanks!
I tried and it worked fine. Seems if there are several columns, the default setting is to go "numeric" by the first one. But that's fine for me.
Michael
I tried and it worked fine. Seems if there are several columns, the default setting is to go "numeric" by the first one. But that's fine for me.
Michael
Re: After getting data from MySQL, how to make the data sequ
Glad it worked.
I suspect from your reply that you might want to experiment with sorting using an undocumented feature of LiveCode, that is, multiple stable sorting.
The method is:
sort container by sortKey1 & sortKey2 & sortKey3...
If you have a table that is tab and return delimited, you could (pseudoCode):
set the itemdelimiter to tab
sort yourTableData by item 1 & item 2 & item 3...
The natural order of the sort would be by lines, and you might find this more compact when dealing with your column data.
I wish it were possible to modify the sortKeys independently, so that you could sort, say, item 1 numeric & item 2 text & item 3 dateTime, etc. But this is not possible.
Craig
I suspect from your reply that you might want to experiment with sorting using an undocumented feature of LiveCode, that is, multiple stable sorting.
The method is:
sort container by sortKey1 & sortKey2 & sortKey3...
If you have a table that is tab and return delimited, you could (pseudoCode):
set the itemdelimiter to tab
sort yourTableData by item 1 & item 2 & item 3...
The natural order of the sort would be by lines, and you might find this more compact when dealing with your column data.
I wish it were possible to modify the sortKeys independently, so that you could sort, say, item 1 numeric & item 2 text & item 3 dateTime, etc. But this is not possible.
Craig
Re: After getting data from MySQL, how to make the data sequ
Aha, Craig
It's really good to know that way of sorting orders.
But the simple "sort data numeric" has met my needs so I'd just stick to it
Thanks anyway, maybe later when I need that complicated way to sort information into the field, I'll look into the codes.
Best regards,
Michael
It's really good to know that way of sorting orders.
But the simple "sort data numeric" has met my needs so I'd just stick to it

Thanks anyway, maybe later when I need that complicated way to sort information into the field, I'll look into the codes.
Best regards,
Michael
Re: After getting data from MySQL, how to make the data sequ
There is another solution : to give the work to MySQL
You can sort results in the SQL select query.

You can sort results in the SQL select query.
Re: After getting data from MySQL, how to make the data sequ
Exactly, try SQL code like:bangkok wrote:There is another solution : to give the work to MySQL
![]()
You can sort results in the SQL select query.
Code: Select all
SELECT time FROM mytable ORDER BY time
Code: Select all
SELECT time FROM mytable ORDER BY time DESC
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w