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
 Active sheet column access by 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

AKazak

Russia
1205 Posts

Posted - 09/02/2020 :  2:02:34 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2021 (64-bit) Beta 4 9.8.0.138
Windows 7 Pro x64 SP1

Greetings!

https://www.originlab.com/doc/LabTalk/ref/Wks-Col-obj suggests:

// Set col(1)'s short name in active sheet as "Time"
wks.col1.name$ = Time;


But this code doesn't work for me.
Can I change the column's short name?
How do I access to column by its short name instead of its serial number, for example wks.col1. or col(1)?


Thank you.

---
Andrey

Edited by - AKazak on 09/02/2020 2:03:16 PM

cpyang

USA
1406 Posts

Posted - 09/02/2020 :  4:06:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You have to turn off SCN (Spreadsheet Cell Notation), so

page.xlcolname=0;
wks.col1.name$=Time;


Once you turn SCN off, you won't be able to use such notation in formula, so better just use long name?

wks.col1.lname$=Time;



CP
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 09/03/2020 :  05:39:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

You have to turn off SCN (Spreadsheet Cell Notation), so

page.xlcolname=0;
wks.col1.name$=Time;


Once you turn SCN off, you won't be able to use such notation in formula, so better just use long name?

wks.col1.lname$=Time;


CP




Got it!

I will continue working in SCN-on mode.
How do I access to column by its short name instead of its serial number, for example wks.col1. or col(1)?
Can I call something like wks.col(A) or wks.col("A")?

Thank you.

---
Andrey
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 09/03/2020 :  07:54:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

range rr = A;
rr.lname$=;


Nikolay
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 09/03/2020 :  09:41:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by nick_n

Hi,

range rr = A;
rr.lname$=;


Nikolay



OK, got it.
How do I clear memory of a range variable after using it?

---
Andrey
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 09/03/2020 :  11:00:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

What for you would like to clear range var? I've never done that.
Try:
range rr=%();
Not sure if it is legal :))
Best,

Nikolay
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 09/03/2020 :  11:09:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Seems, right way is:
del -ra rr;

Nikolay
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 09/03/2020 :  11:12:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
or -rar

Nikolay
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/03/2020 :  11:57:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
variables are local and automatically deleted on existing a scope.
Typically we put codes into ogs sections which is a type of a scope.

See

https://d2mvzyuse3lwjc.cloudfront.net/doc/LabTalk/guide/Data-Types-and-vars#Scope_of_Variables

CP
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 09/03/2020 :  12:16:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Nikolay, CP

Got it.
Thank you.

---
Andrey
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