| 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 |