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
 Get column index from long name
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Katti

Norway
13 Posts

Posted - 09/19/2018 :  10:39:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I'd like to get the column index of a column with a specified long name or short name. I.e. I want to search a sheet for the column what has long name "capacity" and return "E" or "5" if the long name of column E is "capacity". Any input on Labtalk commands that will let me do this?

Hideo Fujii

USA
1582 Posts

Posted - 09/19/2018 :  12:10:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Katti,

How about like this?
token(nameof([Book1]!col("capacity"))$,2,'_')$=;
--Hideo Fujii

Edited by - Hideo Fujii on 09/19/2018 12:12:43 PM
Go to Top of Page

Katti

Norway
13 Posts

Posted - 09/27/2018 :  10:18:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by Hideo Fujii

Hi Katti,

How about like this?
token(nameof([Book1]!col("capacity"))$,2,'_')$=;
--Hideo Fujii



Yep, that works. Thanks
Go to Top of Page

minimax

359 Posts

Posted - 10/11/2018 :  10:16:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Katti,

Range syntax would be a useful way to get plenty of info from a specified Origin object, like following

range ra=[Book1]Sheet2!col("capacity");
ra.name$=; //short name
ra.index=; //index

rA.lname$=; //long name
rA.nRows=; //number of rows in the column
rA.unit$=; //text in Units label row
//etc.


See more introduction for Range in

https://www.originlab.com/doc/LabTalk/guide/Range-Notation
Go to Top of Page

Katti

Norway
13 Posts

Posted - 10/17/2018 :  05:21:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by minimax

Hi Katti,

Range syntax would be a useful way to get plenty of info from a specified Origin object, like following

range ra=[Book1]Sheet2!col("capacity");
ra.name$=; //short name
ra.index=; //index

rA.lname$=; //long name
rA.nRows=; //number of rows in the column
rA.unit$=; //text in Units label row
//etc.


See more introduction for Range in

https://www.originlab.com/doc/LabTalk/guide/Range-Notation




Hi Hideo,

Thanks a lot, it gets a lot easier with range notation. What I did was:

range ra="capacity" // ra represents column with long name "capacity"
ra.index=; // which lets me get the column index
ra.name=; // and column name

Thanks for the help :-)

Edited by - Katti on 10/17/2018 05:22:36 AM
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