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
 Check existence of tree branch or node
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JokerOne

Germany
58 Posts

Posted - 03/04/2016 :  10:45:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 9.1 and Service Release 1(Select Help-->About Origin):
Operating System: Win 7

Is there a LabTalk command available that can check if a certain tree node or tree branch exists?
e.g.

tree aaa;
aaa.bbb= 1
exist(aaa.bbb) [ = 4 expected, but results:24 ]
exist(aaa.ccc) [ = 0 expected, but results:24 ]



Edited by - JokerOne on 03/04/2016 10:57:24 AM

cpyang

USA
1406 Posts

Posted - 03/04/2016 :  10:46:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Looks like we have implemented this for internal use and never documented it. I debugged into it and found ORG-875 and it really work, so you are in luck with this one, see code below

tree aaa;
aaa.bbb= 1;
aaa.ccc= 2;
aaa.ddd= 3;

exist(aaa.anything,24)=;//this will only check the tree existed and no node checking
if(exist(aaa.anyjunk)==24) type "aaa is a tree";
aaa@=;//this should return 2 for a branch
aaa.bbb@=;//this should return 1 for a leaf
if(aaa.ccc@>0) type "aaa.ccc is valid tree node";
if(aaa.junk@==0) type "aaa.junk is not valid";
if(aaa@==2) type "aaa is a tree branch";
if(aaa.bbb@==1) type "aaa.bbb is a tree leaf";


Go to Top of Page

JokerOne

Germany
58 Posts

Posted - 03/07/2016 :  05:52:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your help. Exactly, what I was looking for.
Despite the fact, that I do not know what ORG-875 is, but nevermind.

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 03/07/2016 :  12:30:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
ORG-875 is the tag that I put down for future references. It is the ID for our internal development database.

CP
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