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
 User Trees
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Drbobshepherd

USA
Posts

Posted - 02/02/2012 :  6:26:43 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am having difficulty programaticly adding a tree to a worksheet. I keep trying the examples in the Help File, "Accessing Metadata", but the trees do not appear in the page Organizer. However, if I use the Organizer to create the trees manually, I can dump them to the Command space with a "wks.tree.=;" command, but only if the proper worksheet is active.

Is this section of the Help File article wrong? I want to add a User Tree to a worksheet without having to make it active. More important, I want to access the data without making the sheet active.

DrBobShepherd

Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:

Penn

China
644 Posts

Posted - 02/02/2012 :  9:58:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi DrBobShepherd,

Do you mean this example, right? I have tried this example, it works, and the trees also appear in the Organizer, you can see the following image.



You can use the range to define the non-active worksheet. For example:

range rr = [book2]sheet2!;
rr!wks.tree.add(input);
rr!wks.tree.input.bb = 0;


Penn
Go to Top of Page

Drbobshepherd

USA
Posts

Posted - 02/03/2012 :  11:50:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Penn,

I tried the example and had a little success. I found I could only see the new tree by closing and then re-opening the Organizer.

I guess I still do not understand trees very welll. What does the "rr!wks.tree.add(input)" line do? The "INPUT" branch does not appear until the next line,"rr!wks.tree.input.bb = 0" is executed. In fact, this line seems to work just as well without the previous command.

What I really want to know is how can I add empty branches to the USER TREE branch of a particular worksheet using LabTalk script? Do I have to add leaves and then delete them?

My ultimate goal is to copy header variable data into the user tree of a worksheet. My plan is:
1. Use the impinfo X-function to create a tree (Let's call it "ProjectTree1") contaning the header info.
2.Create an empty tree branch in the worksheet user tree.
3.Copy the header data and structure from ProjectTree1 to the empty worksheet branch using the assignment(=)command.

So far, I have not been able to get past Step 2.

DrBobShepherd
Go to Top of Page

Sophy

China
Posts

Posted - 02/05/2012 :  9:45:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi DrBobShepherd,

I am sorry that currently there is no way to do that in Labtalk, but you can write a simple Origin C function(in Origin C we provide full control of the storage in Organizer) to access any tree branch in the Organizer.
Go to Top of Page

AKazak

Russia
1205 Posts

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

To add a node we use:
wks.tree.add(NodeName)


How do we set a node type (Numeric, Text or Branch) or delete 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