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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Unable to sort a worksheet

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
wilsonthongwk Posted - 06/06/2007 : 02:59:11 AM
Origin Version (Select Help-->About Origin): Pro7.5 (SR0)
Operating System: WinXP

I use the following function to sort a worksheet. It is almost the same as the \Samples\Programming\Origin C Files\LabTalkAccessEx.c example.

void sortWks(string wksName, int sort_i)
{
using sort = LabTalk.sort;

Worksheet wks(wksName);
Dataset sortDS(wksName, sort_i);
Column sortCol = wks.Columns(sort_i);
string LTcom;

sort.wksname$ = wksName;
sort.c1 = 0;
sort.c2 = 100;
sort.r1 = 1;
sort.r2 = sortDS.GetSize();
LTcom = "A: ";
LTcom += sortCol.GetName();
sort.cname1$ = LTcom;
sort.wks();
}

The problem is the following. If I place a breakpoint before the "sort.wks();", it sorts an entire worksheet successfully. However if I don't place a breakpoint or place it after the "sort.wks();", it sorts only one column instread of the entire worksheet!!

I tried the following, but none can solve it.
- Don't use "using". Place the LabTalk codes inside the _LT_Obj block. => Doesn't work.
- Don't write a subfunction. Just write the LabTalk codes directly on where the function is called. -> Dosn't work.
- Don't use "using" nor _LT_Obj block. Code each link of LabTalk command in the LT_execute function. -> Doesn't work.

Any help are greatly appreciated. ^^
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 06/06/2007 : 10:52:02 PM
In most cases the descriptions for OC functions are taken from the corresponding .H file but help files are not always up to date. Since you have the release version (SR0) of O75 I strongly recommend that you update to the latest version (SR6). That will give you many bug fixes and additions as well as the latest help files. Run Help > Check for Updates and download/install anything that's offered. Repeat until no updates are found.

Mike Buess
Origin WebRing Member
wilsonthongwk Posted - 06/06/2007 : 10:43:24 PM
Perfect!! Thanks a lot~ ^^

I think I should be keep looking those header files (such as wksheet.h) when writing Origin C, instead of looking the help. The wksheet.h explains the Worksheet::Sort very clearly. Thank you for your help.
Mike Buess Posted - 06/06/2007 : 06:37:48 AM
Not sure what's wrong but Origin C has Worksheet::Sort in O75. The following function does what yours is meant to do.

void sortwks(string wksName, int sort_i)
{
Worksheet wks(wksName);
wks.Sort(sort_i);
}

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000