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
 Origin Forum
 getting values from different worksheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Jualia

Germany
Posts

Posted - 12/21/2006 :  08:28:34 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 12/21/2006 :  09:20:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Jualia

Germany
Posts

Posted - 12/22/2006 :  09:47:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 12/22/2006 :  12:38:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Jualia

Germany
Posts

Posted - 01/02/2007 :  05:08:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks - I'll try this
Go to Top of Page

Jualia

Germany
Posts

Posted - 01/02/2007 :  10:29:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/02/2007 :  2:02:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Jualia

Germany
Posts

Posted - 01/05/2007 :  09:07:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/05/2007 :  09:39:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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