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
 Storing general info about worksheet
 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
1228 Posts

Posted - 09/02/2020 :  10:08:44 AM  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!

I import an instrument text-file log where extract general info such as Start Date and Start Time from file header to variables with Add variable to page info and Create User Parameter rows for each variable options turned on (ticked).

Add variable to page info works fine but adds the variable to workbook metadata, but not to worksheet's metadata.
Create User Parameter rows for each variable options turned on also works as expected, but adds Column Label Rows filled with the same values for all the columns.

What is the best place to store general variables pertaining to the whole worksheet?
How do I access these variables in Formula of Set Values dialogs?

Thank you.

---
Andrey

YimingChen

1687 Posts

Posted - 09/02/2020 :  10:47:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can extract the variables and save as column header and access those variables later. Please check this page on accessing column header row variables.
https://www.originlab.com/doc/LabTalk/guide/Accessing-Metadata#Column_Label_Rows

James
Go to Top of Page

lkb0221

China
497 Posts

Posted - 09/02/2020 :  10:54:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can also access the workbook/worksheet user tree to store/read values by LabTalk commands. See the documents here:
https://www.originlab.com/doc/LabTalk/guide/Accessing-Metadata#User_Tree_in_a_Worksheet
Go to Top of Page

AKazak

Russia
1228 Posts

Posted - 09/02/2020 :  12:01:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

You can extract the variables and save as column header and access those variables later. Please check this page on accessing column header row variables.
https://www.originlab.com/doc/LabTalk/guide/Accessing-Metadata#Column_Label_Rows

James



Currently, I extract the variables and save toe Column Label Rows and access them using Col(n)[Dm]$;.
But I don't like that Create User Parameter rows for each variable fills Column Label Rows with the same values for all the columns.

quote:
Originally posted by lkb0221

You can also access the workbook/worksheet user tree to store/read values by LabTalk commands. See the documents here:
https://www.originlab.com/doc/LabTalk/guide/Accessing-Metadata#User_Tree_in_a_Worksheet


OK. The worksheet tree seems to be an appropriate way of storing general worksheet properties.
How do I extract variables to the sheet tree on text-file import?
How do I access tree branches from Set Values dialog?

---
Andrey
Go to Top of Page

Chris D

428 Posts

Posted - 09/02/2020 :  1:44:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
From our Labtalk scripting guide (https://www.originlab.com/doc/LabTalk/guide):

Worksheet


// Here we add two trees to the active sheet
wks.tree.add(Input);

// Dynamically create a branch and value
wks.tree.input.Min=0;

// Add another value
wks.tree.input.max=1;

// Add second tree
wks.tree.add(Output);

// and two more values
wks.tree.output.min=-100;
wks.tree.output.max=100;

// Now dump the tree
wks.tree.=;

// or access it
ty Input $(wks.tree.input.min)to $(wks.tree.input.max);
ty Output $(wks.tree.output.min)to $(wks.tree.output.max);

// Access a sheet-level tree using a range
range rs =[Book7]Sheet2!;
rs!wks.tree.=;

Column

// Create a COLUMN tree
wks.col2.tree.add(Batch);

// Add a branch
wks.col2.tree.batch.addsection(Mix);

// and two values in the branch
wks.col2.tree.batch.mix.ratio$="20:15:2";
wks.col2.tree.batch.mix.BatchNo=113210;

// Add branch dynamically and add values
wks.col2.tree.batch.Line.No=7;
wks.col2.tree.batch.Line.Date$=3/15/2010; 

// Dump the tree to the Script Window
wks.col2.tree.=;

// Or access the tree
batch =wks.col2.tree.batch.mix.batchno;
string strDate$=wks.col2.tree.batch.Line.Date$;
ty Batch $(batch)made on %(strDate$)[$(date(%(strDate$)))];


This should give you enough to work with.


Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

AKazak

Russia
1228 Posts

Posted - 09/02/2020 :  1:59:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Chris,

Thank you.
I've written a three-line LT script after import that copies extracted variables from USER.VARIABLES to the target sheet node. Very easy and straightforward.

How do we set a node type (Numeric, Text or Branch) or delete it via LT?


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