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 for Programming
 Forum for Origin C
 Clear worksheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 11/03/2003 :  11:52:28 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

Is there a simple reliable (ie permament) way to clear an entire worksheet with LabTakl or origin C - Clearworksheet macro does not clear ie data can be brought back by eg 'set %H -e 10'?

I have used :

works -s 0 0 0 0;
menu -e 57632;

With 6.0 & 6.1 I don't get prompted 'Are you sure etc..' but I do with 7.5 - is this a setting somewhere?

Cheers,

Pete



Edited by - peter.cook on 11/03/2003 11:54:06 AM

cpyang

USA
1406 Posts

Posted - 11/03/2003 :  12:35:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The following LT code in OC should work

 
void clear_worksheet(string strWksName = "data1")
{
Worksheet wks(strWksName);
if(wks)
wks.LT_execute("set %H -er 30;set %H -em 0;set %H -update");
else
out_str("no such worksheet");
}




CP


Go to Top of Page

peter.cook

UK
356 Posts

Posted - 11/04/2003 :  04:16:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CP.

Thanks - this works fine.

Should the clearworksheet macro be modified accordingly or is it's behaviour (by compariosn) intentional?

Cheers,

Pete

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 11/04/2003 :  08:29:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
ClearWorksheet macro was defined a long time ago, before set -em was implemented. We are not sure if there would be script out there that didn't want to fill with missing values after ClearWorksheet.

We are going to add a method(5471) into OC Worksheet class for SR1 that will do this cleanly in OC. This new method is going to be like this,


/**
Parameters:
nNumRows = number of rows in worksheet, use -1 to keep current settings
nNumCols = number of columns, use -1 to keep current settings
bClearData = decide if existing data in worksheet should be cleared. If True, then all data in worksheet is reset to missing values and each column is reset to upper index = 0, if FALSE, then no action is taken on both the data and the upper index on each column, and newly added columns will be in default state
Remarks:
If nNumCols is larger then the current number of columns in the worksheet, then new columns will be added using enumerated column names which is faster then calling AddCol
*/
BOOL SetSize(int nNumRows, int nNumCols, BOOL bClearData = FALSE);



so to do clear worksheet, can call SetSize(-1, -1). The current AddCol function is rather slow, so this new method will solve that problem as well.


CP


Go to Top of Page

peter.cook

UK
356 Posts

Posted - 11/05/2003 :  10:20:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
HI CP,

Fair enough!

Addition for SR1 sounds good.

Cheers,

Pete

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