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
 Origin Forum
 getting values from different worksheets

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
Jualia Posted - 12/21/2006 : 08:28:34 AM
Hello everybody!

I'd like to write values from different worksheets in the rows of one column of another worksheet - so in the first box a value from worksheet N1, in the second box one from the worksheet N2,....
Is it possible to get all those values at once or do I really have to get them all one my one?

Hopefully somebody can help me

Jules
8   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 01/05/2007 : 09:39:16 AM
if( cc==0/0 ) cc=1;
if( rr==0/0 ) rr=1;
if( %A=="" ) %A=Test;
if( %W=="" ) %W=Work;
getn
(Output worksheet) %%W
(Input worksheets) %%A
(Column #) cc
(Row #) rr
( );
na=%[%A]+1; // length+1 of %A
nn=1;
if( !exist(%W,2) ) win -n W %W;
%W!wks.AddCol(); // add column for Test #
%W!wks.AddCol(); // add column for value
cw=%W!wks.ncols;
%Z=wks: %A
col: $(cc)
row: $(rr);
%W!wks.col$(cw).label$=%Z;
%W!wks.labels();
doc -e W {
if("%[%H,na]"=="%A") {
%(%W,cw-1,nn)=%[%H,>na]; // get Test #
%(%W,cw,nn)=%(%H,cc,rr); // get cell value
nn++;
};
};
win -o %W {
sort -c cw cw %(%H,cw-1); // sort values wrt Test #
del %(%H,cw-1); // delete Test #
};

Mike Buess
Origin WebRing Member
Jualia Posted - 01/05/2007 : 09:07:40 AM
I have Origin 6.0! and I don't know why but now it works
Is there a way to affect the order in which the test-worksheets are opened and read out? Because right now it just takes the worksheet which was created first and then the one which was created after that and so on. I would like to get first the value from worksheet test1, then from test2, .... no matter in which order they were created.

Jules
Mike Buess Posted - 01/02/2007 : 2:02:08 PM
That's not what happens when I run the script in Origin 7.5. For example, I have 4 worksheets: Data1, Test1, Test2 and Test3. I want to copy row1, column1 from each Test wks to a Work wks so I run the script and OK the following dialog...



The resulting Work wks looks like this...



You get different results? If so you are probably running an earlier version of Origin. (For example, the script gives a command error in Origin 5.0.) What version are you running?

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/02/2007 2:05:21 PM
Jualia Posted - 01/02/2007 : 10:29:53 AM
ok - I tried your program and it works in princial - its just, that the loop takes just the value from the first test-worksheet and writes this in the work-worksheet, but not for the others. Is there something I need to do with the test-worksheets that the doc -e loop can open them and read values from them?
Jualia Posted - 01/02/2007 : 05:08:09 AM
thanks - I'll try this
Mike Buess Posted - 12/22/2006 : 12:38:39 PM
You don't say where you want to put the results in "Work" so I'll assume you want to add them to the same column. This script brings up a dialog in which you name the "Test" and "Work" worksheets and set the column/row numbers. "Work" worksheet is created if it doesn't already exist, otherwise results for each "Test", col#, row# are added as new column. You can run the script from the Custom Routine Button as described here.

if( cc==0/0 ) cc=1;
if( rr==0/0 ) rr=1;
if( %A=="" ) %A=Test;
if( %W=="" ) %W=Work;
getn
(Output worksheet) %%W
(Input worksheets) %%A
(Column #) cc
(Row #) rr
( );
na=%[%A]+1; // length+1 of %A
nn=1;
if( !exist(%W,2) ) win -n W %W;
%W!wks.AddCol();
cw=%W!wks.ncols;
%Z=wks: %A
col: $(cc)
row: $(rr);
%W!wks.col$(cw).label$=%Z;
%W!wks.labels();
doc -e W {
if("%[%H,na]"=="%A") {
%(%W,cw,nn)=%(%H,cc,rr);
nn++;
};
};

Mike Buess
Origin WebRing Member
Jualia Posted - 12/22/2006 : 09:47:50 AM
mmmhh, I try to make it more clear....

I have serveral worksheets (lets call them "test1", "test2",...) with the same kind of data in it but from different test cycles. The I have a worksheet (called "work") where I want to make calculations with the values from test1, test2, ....
For this I need from every test-worksheet one specific value, which is alwas in the same row and column, but I need it from every test worksheet.
Until now, I get those values with "set column values" and there I have to change the name of the test worksheet manually, depending on from which worksheet I want to get the value. This costs a lot of time and I want to do this automaticly - if this is possible.
Maybe somebody already wrote some kind of script for this problem or there is a much easier way to do this....

Jules
Mike Buess Posted - 12/21/2006 : 09:20:28 AM
Hi Jules,

Your explanation is not clear enough but see Help > Programming > LabTalk Language Ref. > Overview... for ways to do it by script.

Mike Buess
Origin WebRing Member

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