The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Sorting columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

amyz

Canada
Posts

Posted - 05/27/2005 :  7:52:58 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I looked up the script for sorting, and found the following:

sort.wksname$ = Data1; // For the worksheet Data1
sort.c1 = 0; // all columns
sort.r1 = 3; // from row 3 to
sort.r2 = 11; // row 11,
sort.cname1$ = D: B;
// using column B as the primary, sort in descending order
sort.cname2$ = A: A;
// and column A as the secondary, sort in ascending order
sort.wks() // execute sort

I changed 'Data1' in line 1 to the name of my worksheet, but the worksheet doesn't respond when I run the script.

A couple of questions...

- Are the starting & ending row numbers necessary? i.e., do we need the following, or would the default be from the first to the last row if I don't include it?
sort.r1 = 3; // from row 3 to
sort.r2 = 11; // row 11

- In sort.cname1$ = D: B, does it matter if I change 'B' to '2'? [same column 'name'], and what if I change it to what I've actually labelled the column? (e.g. 'y') Right now, I'm not sure of any differences this would make, b/c the worksheet doesn't respond in any case...

Thank you

easwar

USA
1964 Posts

Posted - 05/30/2005 :  2:24:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

First of all, the code you posted here is from an example in the LabTalk reference help file, but there is a ; missing in the last line - try changing that line to
sort.wks(); // execute sort
and then highlight all lines of code and hit enter to sort.

As for column name, you need to use the exact column name and not the label or index etc.

Easwar
OriginLab


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000