Sorting Lines by Item

Mark Smith mark at maseurope.net
Thu Sep 1 19:25:37 EDT 2005


 From the docs:

--
The sort command is a stable sort. This means that if the sortKey for 
two cards is the same, sorting does not change their order, so you can 
do two successive sorts to create subcategories within the major sort 
categories. For example, to sort the cards of a stack by ZIP code and 
sort within each ZIP code by last names, use these two statements:

   sort cards by field "Last Name"
   sort cards numeric by field "ZIP code"
--

so

sort lines of fld "dataField" by item 2 of each
sort lines of fld "dataField" by item 3 of each
sort lines of fld "dataField" by item 4 of each

Is this what you need?

Cheers,

Mark

On 2 Sep 2005, at 00:10, Stewart Lynch wrote:

> I have data that needs to be sorted a certain way after I bring it in 
> to a
> text field called DataField
>
> Each line in the data has 6 items separated by a tab so I can set the
> itemdelimeter to Tab
> I need to sort the data by Item 2 then Item 3 then Item 4.
> So, for example
> 3838033	R.  Chin	1	B	XESL 11	12
> 3838033	R.  Chin	2	C	XESL 10	17
> 3838033	J.  Clemente	1	B	SCH 11	23
> 3838033	R.  Chin	1	D	XESL 11	15
> 3838033	R.  Chin	2	B	XESL 11	15
> 3838033	R.  Chin	1	C	XESL 10	11
> 3838033	J.  Clemente	1	A	SS 9	27
> 3838033	R.  Chin	1	D	XESL 10	16
> 3838033	J.  Clemente	1	A	SCH 11	27
> 3838033	J.  Clemente	1	D	SCH 9	26
> 3838033	J.  Clemente	2	A	SS 11	26
> 3838033	J.  Clemente	1	B	SCH 9	28
> 3838033	J.  Clemente	1	C	SCH 10	29
>
> Gets sorted as
>
> 3838033	J.  Clemente	1	A	SS 9	27
> 3838033	J.  Clemente	1	A	SCH 11	27
> 3838033	J.  Clemente	1	B	SCH 11	23
> 3838033	J.  Clemente	1	B	SCH 9	28
> 3838033	J.  Clemente	1	C	SCH 10	29
> 3838033	J.  Clemente	1	D	SCH 9	26
> 3838033	J.  Clemente	2	A	SS 11	26
> 3838033	R.  Chin	1	B	XESL 11	12
> 3838033	R.  Chin	1	C	XESL 10	11
> 3838033	R.  Chin	1	D	XESL 11	15
> 3838033	R.  Chin	1	D	XESL 10	16
> 3838033	R.  Chin	2	B	XESL 11	15
> 3838033	R.  Chin	2	C	XESL 10	17
>
> I see that there is the command
>
> Sort lines of field DataField by item 2
>
> What would I do to have the lines sorted by item 2,3 and 4 in that 
> order?
>
> *******************************************
> ........
> :  o/  : Stewart Lynch
> : <|   : Director of Instruction, Technology and Information Services
> : / >  : Richmond School District
> :......:   Richmond, BC Canada
> Internet: slynch at richmond.sd38.bc.ca
> https://public.sd38.bc.ca/~slynch
> tel. (604) 668-6128 fax: (604) 668-6006
> *******************************************
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list