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
 LabTalk Forum
 accessing colums in multiple sheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Sell

Germany
20 Posts

Posted - 01/30/2010 :  2:17:45 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.81 and Service Release SR1 (Select Help-->About Origin):
Operating System:XP

I have a couple of sheets with the same structure and would like to include all columns with the name, let's say ZX into a graph layer. I would like to use the layer.include() function. How can I loop through all the sheets and add from there the dataset in column ZX

larry_lan

China
Posts

Posted - 01/31/2010 :  10:52:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi:

How about the doc -e command? For example:
doc -e l
{
	ty The active layer is in %H, layer $(page.active);
}

Thanks
Larry

Edited by - larry_lan on 01/31/2010 10:52:54 PM
Go to Top of Page

Sell

Germany
20 Posts

Posted - 02/01/2010 :  03:52:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This fits not the need. The solution might be in a range or string array variable. But the question is how to loop through such variables. There is a nice example in the labtalk help:
range rs = [Book1]4:end!
But I could not found neither how to loop through this variable nor what is really stored in it.
Go to Top of Page

easwar

USA
1964 Posts

Posted - 02/01/2010 :  10:30:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

As you are looking for a column with a specific shortname, you can use the colnum() function to check if index is non-zero to see if the column exists, such as with code below. Then you can get dataset to add to your graph, or use the plotxy x-function to plot to graph using range defined from the column etc.


// Loop over all sheets
doc -e LB {
	// Type out window name and sheet name 
	type "Book: %h, sheet: %(wks.name$)";
	// Check for column with specific short name
	int ii = colnum(ZX);
	if(ii != 0)
		type "   Column exists, index = $(ii)";
}

Go to Top of Page

Sell

Germany
20 Posts

Posted - 02/01/2010 :  10:40:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you both!
I never used the doc -e command. Very powerful! It is the solution for my problem. Completely unexpected. It remains the question on how to loop over a range or string array variable including substitution. But this has time until it goes beyond doc -e ;-)

Hans-Jrgen Sell
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