sort lines in text field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
doloop
Posts: 2
Joined: Wed Oct 23, 2013 10:51 am

sort lines in text field

Post by doloop » Wed Oct 23, 2013 10:59 am

I have downloaded Yahoo historical price data and placed it in a variable named "buffer1". Yahoo data is in reverse chronological order. I want the data in chronological order.

Here are the first three lines of the data:

2013-10-22,25.50,26.12,25.43,26.02,53407700,26.02
2013-10-21,24.47,24.97,24.43,24.93,27049900,24.93
2013-10-18,24.52,24.77,24.30,24.38,23734800,24.38

As you can see the 1st item of each line is the date. I used the following command to resort the data, but it does not work:

sort lines of buffer1 ascending dateTime by item 1 of each

What am I doing wrong?

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: sort lines in text field

Post by snm » Wed Oct 23, 2013 11:31 am

Item 1 is not dateTime in your variable - you have only text there.

Code: Select all

sort lines of buffer1 ascending by item 1 of each
This works with your data in variable.
Marek

doloop
Posts: 2
Joined: Wed Oct 23, 2013 10:51 am

Re: sort lines in text field

Post by doloop » Wed Oct 23, 2013 1:36 pm

That works! Thank you. :D

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: sort lines in text field

Post by snm » Wed Oct 23, 2013 1:54 pm

You are welcome.

Marek

Post Reply