Author |
Topic  |
|
moondream
Netherlands
22 Posts |
Posted - 09/20/2002 : 10:16:01 AM
|
Hi, all,
how can i set data in an inactive worksheet column? I can set col(3)= 4 in an active worksheet, but I could not set data1.col(3)=4, how could i do that?
thanks
moondream |
|
moondream
Netherlands
22 Posts |
Posted - 09/20/2002 : 10:38:10 AM
|
sorry i know how to do it, but i can not set the data to a empty worksheet by data1_b=3.
best regards,
moondream
|
 |
|
Mike Buess
USA
3037 Posts |
Posted - 09/20/2002 : 10:50:58 AM
|
Hi moondream,
Try this...
nrows=512; // decide how many rows you want set data1 -er nrows; // set the wks to that size data1_b=data(1,nrows); // fill col B with a data set (may not be necessary) data1_b=3; // set it to the correct value
Mike Buess Origin WebRing Member |
 |
|
moondream
Netherlands
22 Posts |
Posted - 09/20/2002 : 11:26:38 AM
|
Hi Mike,
Thanks alot. I do need "data1_b=data(1,nrows)". May ask you another question? How can i copy all the B columns in other worksheets to a new worksheet (supposed name RESULT)? Should i use "doc -e w{ }", but how do i avoid to copy the B column of RESULT?
best regards,
moondream |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 09/20/2002 : 12:03:39 PM
|
The name of the wks that is being handled in each iteration of doc -e W can be accessed by the string variable %H. So only do your copying if %H is not RESULT...
doc -e W { if(%H!="RESULT") { -- your copy scripts go here -- }; };
Mike Buess Origin WebRing Member |
 |
|
moondream
Netherlands
22 Posts |
Posted - 09/21/2002 : 06:46:08 AM
|
Hi, Mike,
I do it like following, ncol=2; doc -e w{ ncol= ncol+1; if (%h !="sumresult"){ %(sumresult,ncol)=%h_b[sumresult_a]} }; is it right?, it doesn't work. could you tell me what wrong with it? thanks.
moondream |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 09/21/2002 : 10:48:37 AM
|
Hi moondream,
It's hard to tell without knowing exactly what you want the script to do and what happens instead (how does it go wrong?), but here are a few things to consider...
1> In order for the script to work, 'sumresult' must already have the correct number of columns. (Based on your other posts in this thread I bet you've set it up properly.)
2> The column index 'ncol' should probably be incremented within the if() statement or you will end up with a blank column in 'sumresult'.
3> 'sumresult_a=;' returns the first value in the dataset 'sumresult_a'. If that value is 3 the command in your if() statement becomes %(sumresult,ncol)=%h_b[3]. Is that what you intended? If not, pls explain what you want to do. Judging from your previous post I thought you wanted to copy the entire col B to 'sumresult'.
Here is how I would rewrite your script based on those points. (I also assume that 'sumresult' is already set up.) I've assigned the wks name to a string variable because it shortens the scripts and makes them easier to change if you decide to rename the wks.
%W=sumresult; ncol=2; doc -e W { // when comparing string variables you must quote both of them if("%H"!="%W") { ncol++; // increment ncol %(%W,ncol)=%H_B[%W_A]; // as you wrote it -- or -- %(%W,ncol)=%H_B; // if my guess is right (but it seldom is ) }; };
Does that help you any?
Mike Buess Origin WebRing Member |
 |
|
moondream
Netherlands
22 Posts |
Posted - 09/22/2002 : 04:53:25 AM
|
Hi, Mike,
Thank you very much. You make it sooooooooo clear. I know where it was wrong now. Thank you for your patient again.
best regards,
moondream |
 |
|
moondream
Netherlands
22 Posts |
Posted - 09/22/2002 : 10:16:26 AM
|
Hi, Mike,
One more question, please. How could I only copy the columns of the worksheets which are non-minimized?
Thanks
Best regards,
moondream |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 09/22/2002 : 1:26:39 PM
|
Hi moondream,
doc -e O operates only on non-minimized windows, but you will have to check each window to make sure it's a worksheet. You can do that with the exist() function (look for it under Miscellaneous (Utility) Functions in LabTalk help)...
doc -e O { if(exist(%H,2)==2 && "%H"!="%W") { -- your scripts go here -- }; };
Mike Buess Origin WebRing Member |
 |
|
moondream
Netherlands
22 Posts |
Posted - 09/23/2002 : 05:22:07 AM
|
Hi, Mike,
Thank you very much. 
Best regards,
moondream |
 |
|
|
Topic  |
|