Re: Sort on two sortTypes

2017-04-10 Thread dunbarx via use-livecode
Ah.

Then you will have to do what, I think, Jacque suggested and sort by two
functions:

sort yourData by functionA() & functionB().

This because once you set the sortStyle (sort numeric, sort dateTime,...)
that must hold through the entirety of the "multiSortKey" method. 

This may be more unnecessarily complicated that simply sorting twice.

Craig



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Sort-on-two-sortTypes-tp4713821p4713858.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sort on two sortTypes

2017-04-10 Thread Randy Hengst via use-livecode
Hi Craig,

Yes, I was able to sort in the way you described… the problem I ran into was... 
where to place the dateTime sortType when using a multiple sort when one 
sortKey was date time and the other text.



be well,
randy

Randy Hengst
www.classroomFocusedSoftware.com


> On Apr 10, 2017, at 8:23 AM, dunbarx via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Since HC days, you have been able to:
> 
> sort yourData by sortKey1 & sortKey2 & 
> 
> sort yourData by item 1 of each & item 2 of each
> 
> Craig Newman
> 
> 
> 
> --
> View this message in context: 
> http://runtime-revolution.278305.n4.nabble.com/Sort-on-two-sortTypes-tp4713821p4713855.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort on two sortTypes

2017-04-10 Thread dunbarx via use-livecode
Since HC days, you have been able to:

sort yourData by sortKey1 & sortKey2 & 

sort yourData by item 1 of each & item 2 of each

Craig Newman



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Sort-on-two-sortTypes-tp4713821p4713855.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sort on two sortTypes

2017-04-08 Thread Randy Hengst via use-livecode
Mike, thank you. I didn’t try the function you mentioned… to be honest, it 
would take me a bit to get my head around it.

be well,
randy

Randy Hengst
www.classroomFocusedSoftware.com



> On Apr 8, 2017, at 1:17 PM, Mike Bonner via use-livecode 
>  wrote:
> 
> do 2 consecutive sorts..
> First by item 3
> then by item 2 datetime
> 
> Alternatively, you might be able to use a function sort to do it, but I'd
> have to really think about how to accomplish it that way, and its too early.
> 
> Basically though, a sort using a function looks like the following example..
> (if the lines contain an item like a hex code for example, 00 to ff, one
> could use a function to convert the value to a decimal and then return the
> decimal value as the numeric sort key)
> 
> sort lines of  ascending numeric by myFunction(each)
> 
> function myFunction pVar
>   return baseconvert(item 3 of pvar,16,10)
> end myFunction
> 
> This would return the decimal value of the hex and use the value as the
> sort key.  Like I say, since you're using two data types for your sort, it
> would require some pondering to figure out the best way to normalize the
> data and generate the proper sort key, but it should be possible.  Still,
> much easier to just do two consecutive sorts.
> 
> 
> On Sat, Apr 8, 2017 at 11:45 AM, Randy Hengst via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> 
>> Hi All,
>> 
>> I’m working an app to facilitate the development of student class
>> schedules.
>> 
>> Right now there are three items for each course that I’d like to sort in
>> various ways: CourseName, Time, Days. The information is placed in that
>> order in a field for display.
>> 
>> It’s easy to sort on any one of the items. For example….
>> sort lines of field "FIRSTyear_FALL" by item 1 of each
>> 
>> sort lines of field "FIRSTyear_FALL" dateTime by item 2 of each
>> 
>> sort lines of field "FIRSTyear_FALL" by item 3 of each
>> 
>> 
>> But I can’t figure out how to sort first on item 3, Days and then by item
>> 2, Time. My goal is sort by matching Days and then by time in ascending
>> order. The courses meeting on the same day would be grouped together by
>> time earliest to latest. A sort does take place, but it’s text. I’ve not
>> figured out how/where to place the dateTime sortType when combining a sort
>> on item 3 and item 2.
>> 
>> Here’s the basic line of script… where does “dateTime” go? I’ve tried
>> placing it in all the points of the line that I can think of….
>> sort lines of field "FIRSTyear_FALL" by item 3 of each & item 2 of each
>> 
>> The dictionary under “Sort Container” suggests what I want to do is
>> possible:
>> The sort container command is a stable sort. This means that if the
>> sortKey for two items or lines is the same, sorting does not change their
>> order, so you can do two successive sorts to create subcategories within
>> the major sort categories.
>> Tip: To create a custom sort order, use the each keyword to pass each line
>> or item to a custom function. The value returned by the function is used as
>> the sort key for that line or item. It is not currently possible to debug
>> custom sort functions, and doing so could make the IDE unstable. It is
>> recommended to use logging messages instead.
>> The information in the “LiveCode Resource Center” doesn’t include an
>> example of sorting on two criteria.
>> 
>> Thanks in advance for any thoughts you can share.
>> 
>> be well,
>> randy
>> 
>> Randy Hengst
>> www.classroomFocusedSoftware.com
>> 
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort with two sortTypes

2017-04-08 Thread Jerry Jensen via use-livecode

> why I didn’t try reversing the order I don’t know… it seems so obvious now. 

Not enough time feeding one of these:
http://www.columbia.edu/cu/computinghistory/082.jpg
;) Jerry


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort with two sortTypes

2017-04-08 Thread Randy Hengst via use-livecode
Well, if I really was channeling you, I’d call that a win!! And besides, then 
I’d be able to provide way more help to the list than I can now!

be well,
randy

Randy Hengst
www.classroomFocusedSoftware.com



> On Apr 8, 2017, at 3:04 PM, J. Landman Gay via use-livecode 
>  wrote:
> 
> It's because you were channeling me, and I had it wrong.
> 
> On 4/8/17 2:58 PM, Randy Hengst via use-livecode wrote:
>> I tried Jacque’s suggestion multiple times… why I didn’t try
>> reversing the order I don’t know…
> 
> 
> -- 
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software   | http://www.hyperactivesw.com
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort with two sortTypes

2017-04-08 Thread J. Landman Gay via use-livecode

It's because you were channeling me, and I had it wrong.

On 4/8/17 2:58 PM, Randy Hengst via use-livecode wrote:

I tried Jacque’s suggestion multiple times… why I didn’t try
reversing the order I don’t know…



--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort with two sortTypes

2017-04-08 Thread Randy Hengst via use-livecode
Thank you, Jacque and Jerry. I tried Jacque’s suggestion multiple times… why I 
didn’t try reversing the order I don’t know… it seems so obvious now. 

Thank you both for the quick response.

be well,
randy

Randy Hengst
www.classroomFocusedSoftware.com


> On Apr 8, 2017, at 2:26 PM, Jerry Jensen via use-livecode 
>  wrote:
> 
> Other way around I think. Sort by time first, then sort by day
> .Jerry
> 
>> On Apr 8, 2017, at 12:07 PM, J. Landman Gay via use-livecode 
>>  wrote:
>> 
>> On 4/8/17 12:47 PM, Randy Hengst via use-livecode wrote:
>>> But I can’t figure out how to sort first on item 3, Days and then by
>>> item 2, Time. My goal is sort by matching Days and then by time in
>>> ascending order. The courses meeting on the same day would be grouped
>>> together by time earliest to latest.
>> 
>> Just run the sort twice:
>> 
>> sort lines of field "FIRSTyear_FALL" by item 3 of each
>> sort lines of field "FIRSTyear_FALL" by item 2 of each
>> 
>> -- 
>> Jacqueline Landman Gay | jac...@hyperactivesw.com
>> HyperActive Software   | http://www.hyperactivesw.com
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort with two sortTypes

2017-04-08 Thread J. Landman Gay via use-livecode

On 4/8/17 2:26 PM, Jerry Jensen via use-livecode wrote:

Other way around I think. Sort by time first, then sort by day
.Jerry


Right, I got the order mixed up. Smallest first.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sort with two sortTypes

2017-04-08 Thread Jerry Jensen via use-livecode
Other way around I think. Sort by time first, then sort by day
.Jerry

> On Apr 8, 2017, at 12:07 PM, J. Landman Gay via use-livecode 
>  wrote:
> 
> On 4/8/17 12:47 PM, Randy Hengst via use-livecode wrote:
>> But I can’t figure out how to sort first on item 3, Days and then by
>> item 2, Time. My goal is sort by matching Days and then by time in
>> ascending order. The courses meeting on the same day would be grouped
>> together by time earliest to latest.
> 
> Just run the sort twice:
> 
> sort lines of field "FIRSTyear_FALL" by item 3 of each
> sort lines of field "FIRSTyear_FALL" by item 2 of each
> 
> -- 
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software   | http://www.hyperactivesw.com
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort with two sortTypes

2017-04-08 Thread J. Landman Gay via use-livecode

On 4/8/17 2:07 PM, J. Landman Gay via use-livecode wrote:

Just run the sort twice:

sort lines of field "FIRSTyear_FALL" by item 3 of each
sort lines of field "FIRSTyear_FALL" by item 2 of each


Also, you probably already know this, but it's more efficient to get the 
field content, sort it twice, and put it back.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sort with two sortTypes

2017-04-08 Thread J. Landman Gay via use-livecode

On 4/8/17 12:47 PM, Randy Hengst via use-livecode wrote:

But I can’t figure out how to sort first on item 3, Days and then by
item 2, Time. My goal is sort by matching Days and then by time in
ascending order. The courses meeting on the same day would be grouped
together by time earliest to latest.


Just run the sort twice:

sort lines of field "FIRSTyear_FALL" by item 3 of each
sort lines of field "FIRSTyear_FALL" by item 2 of each

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort on two sortTypes

2017-04-08 Thread Jerry Jensen via use-livecode
Bernd’s modTableField will let you do a custom sort. A sort function using 
something like your example:
> by (item 3 of each & item 2 of each)
should do the trick. It uses LC’s sort container function so the dictionary 
does apply.
On the other hand, if you sort by one item at a time, sort by the least 
significant item first, as in sort by the time item and then by the day item.
.Jerry

> On Apr 8, 2017, at 10:45 AM, Randy Hengst via use-livecode 
>  wrote:
> 
> Hi All,
> 
> I’m working an app to facilitate the development of student class schedules.
> 
> Right now there are three items for each course that I’d like to sort in 
> various ways: CourseName, Time, Days. The information is placed in that order 
> in a field for display.
> 
> It’s easy to sort on any one of the items. For example….
> sort lines of field "FIRSTyear_FALL" by item 1 of each
> 
> sort lines of field "FIRSTyear_FALL" dateTime by item 2 of each
> 
> sort lines of field "FIRSTyear_FALL" by item 3 of each
> 
> 
> But I can’t figure out how to sort first on item 3, Days and then by item 2, 
> Time. My goal is sort by matching Days and then by time in ascending order. 
> The courses meeting on the same day would be grouped together by time 
> earliest to latest. A sort does take place, but it’s text. I’ve not figured 
> out how/where to place the dateTime sortType when combining a sort on item 3 
> and item 2. 
> 
> Here’s the basic line of script… where does “dateTime” go? I’ve tried placing 
> it in all the points of the line that I can think of….
> sort lines of field "FIRSTyear_FALL" by item 3 of each & item 2 of each
> 
> The dictionary under “Sort Container” suggests what I want to do is possible:
> The sort container command is a stable sort. This means that if the sortKey 
> for two items or lines is the same, sorting does not change their order, so 
> you can do two successive sorts to create subcategories within the major sort 
> categories.
> Tip: To create a custom sort order, use the each keyword to pass each line or 
> item to a custom function. The value returned by the function is used as the 
> sort key for that line or item. It is not currently possible to debug custom 
> sort functions, and doing so could make the IDE unstable. It is recommended 
> to use logging messages instead.
> The information in the “LiveCode Resource Center” doesn’t include an example 
> of sorting on two criteria.
> 
> Thanks in advance for any thoughts you can share.
> 
> be well,
> randy
> 
> Randy Hengst
> www.classroomFocusedSoftware.com
> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sort on two sortTypes

2017-04-08 Thread Mike Bonner via use-livecode
do 2 consecutive sorts..
First by item 3
then by item 2 datetime

Alternatively, you might be able to use a function sort to do it, but I'd
have to really think about how to accomplish it that way, and its too early.

Basically though, a sort using a function looks like the following example..
(if the lines contain an item like a hex code for example, 00 to ff, one
could use a function to convert the value to a decimal and then return the
decimal value as the numeric sort key)

sort lines of  ascending numeric by myFunction(each)

function myFunction pVar
   return baseconvert(item 3 of pvar,16,10)
end myFunction

This would return the decimal value of the hex and use the value as the
sort key.  Like I say, since you're using two data types for your sort, it
would require some pondering to figure out the best way to normalize the
data and generate the proper sort key, but it should be possible.  Still,
much easier to just do two consecutive sorts.


On Sat, Apr 8, 2017 at 11:45 AM, Randy Hengst via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Hi All,
>
> I’m working an app to facilitate the development of student class
> schedules.
>
> Right now there are three items for each course that I’d like to sort in
> various ways: CourseName, Time, Days. The information is placed in that
> order in a field for display.
>
> It’s easy to sort on any one of the items. For example….
> sort lines of field "FIRSTyear_FALL" by item 1 of each
>
> sort lines of field "FIRSTyear_FALL" dateTime by item 2 of each
>
> sort lines of field "FIRSTyear_FALL" by item 3 of each
>
>
> But I can’t figure out how to sort first on item 3, Days and then by item
> 2, Time. My goal is sort by matching Days and then by time in ascending
> order. The courses meeting on the same day would be grouped together by
> time earliest to latest. A sort does take place, but it’s text. I’ve not
> figured out how/where to place the dateTime sortType when combining a sort
> on item 3 and item 2.
>
> Here’s the basic line of script… where does “dateTime” go? I’ve tried
> placing it in all the points of the line that I can think of….
> sort lines of field "FIRSTyear_FALL" by item 3 of each & item 2 of each
>
> The dictionary under “Sort Container” suggests what I want to do is
> possible:
> The sort container command is a stable sort. This means that if the
> sortKey for two items or lines is the same, sorting does not change their
> order, so you can do two successive sorts to create subcategories within
> the major sort categories.
> Tip: To create a custom sort order, use the each keyword to pass each line
> or item to a custom function. The value returned by the function is used as
> the sort key for that line or item. It is not currently possible to debug
> custom sort functions, and doing so could make the IDE unstable. It is
> recommended to use logging messages instead.
> The information in the “LiveCode Resource Center” doesn’t include an
> example of sorting on two criteria.
>
> Thanks in advance for any thoughts you can share.
>
> be well,
> randy
>
> Randy Hengst
> www.classroomFocusedSoftware.com
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Sort with two sortTypes

2017-04-08 Thread Randy Hengst via use-livecode
Hi All,

I’m working an app to facilitate the development of student class schedules.

Right now there are three items for each course that I’d like to sort in 
various ways: CourseName, Time, Days. The information is placed in that order 
in a field for display.

It’s easy to sort on any one of the items. For example….
sort lines of field "FIRSTyear_FALL" by item 1 of each

sort lines of field "FIRSTyear_FALL" dateTime by item 2 of each

sort lines of field "FIRSTyear_FALL" by item 3 of each


But I can’t figure out how to sort first on item 3, Days and then by item 2, 
Time. My goal is sort by matching Days and then by time in ascending order. The 
courses meeting on the same day would be grouped together by time earliest to 
latest. A sort does take place, but it’s text. I’ve not figured out how/where 
to place the dateTime sortType when combining a sort on item 3 and item 2. 

Here’s the basic line of script… where does “dateTime” go? I’ve tried placing 
it in all the points of the line that I can think of….
sort lines of field "FIRSTyear_FALL" by item 3 of each & item 2 of each

The dictionary under “Sort Container” suggests what I want to do is possible:
The sort container command is a stable sort. This means that if the sortKey for 
two items or lines is the same, sorting does not change their order, so you can 
do two successive sorts to create subcategories within the major sort 
categories.
Tip: To create a custom sort order, use the each keyword to pass each line or 
item to a custom function. The value returned by the function is used as the 
sort key for that line or item. It is not currently possible to debug custom 
sort functions, and doing so could make the IDE unstable. It is recommended to 
use logging messages instead.
The information in the “LiveCode Resource Center” doesn’t include an example of 
sorting on two criteria.

Thanks in advance for any thoughts you can share.

be well,
randy

Randy Hengst
www.classroomFocusedSoftware.com 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Sort on two sortTypes

2017-04-08 Thread Randy Hengst via use-livecode
Hi All,

I’m working an app to facilitate the development of student class schedules.

Right now there are three items for each course that I’d like to sort in 
various ways: CourseName, Time, Days. The information is placed in that order 
in a field for display.

It’s easy to sort on any one of the items. For example….
sort lines of field "FIRSTyear_FALL" by item 1 of each

sort lines of field "FIRSTyear_FALL" dateTime by item 2 of each

sort lines of field "FIRSTyear_FALL" by item 3 of each


But I can’t figure out how to sort first on item 3, Days and then by item 2, 
Time. My goal is sort by matching Days and then by time in ascending order. The 
courses meeting on the same day would be grouped together by time earliest to 
latest. A sort does take place, but it’s text. I’ve not figured out how/where 
to place the dateTime sortType when combining a sort on item 3 and item 2. 

Here’s the basic line of script… where does “dateTime” go? I’ve tried placing 
it in all the points of the line that I can think of….
sort lines of field "FIRSTyear_FALL" by item 3 of each & item 2 of each

The dictionary under “Sort Container” suggests what I want to do is possible:
The sort container command is a stable sort. This means that if the sortKey for 
two items or lines is the same, sorting does not change their order, so you can 
do two successive sorts to create subcategories within the major sort 
categories.
Tip: To create a custom sort order, use the each keyword to pass each line or 
item to a custom function. The value returned by the function is used as the 
sort key for that line or item. It is not currently possible to debug custom 
sort functions, and doing so could make the IDE unstable. It is recommended to 
use logging messages instead.
The information in the “LiveCode Resource Center” doesn’t include an example of 
sorting on two criteria.

Thanks in advance for any thoughts you can share.

be well,
randy

Randy Hengst
www.classroomFocusedSoftware.com



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode