cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
BabyDoragon
Level I

Using Character Variables with SetData in Tree Nodes

I hope to use "Set data" to configure the information in the tree node. However, the variable usage does not meet my expectations. As shown in the JSL below, I want to record the text "Test" in the variable Title and set it into C1, so that Show(C1) displays as C1 << Get Data = {"Test", "", 1};
The results of using a variable (C1 situation) and directly using text data (C2 situation) for setData differ, which leads to errors when I later attempt to retrieve the data. How can I use a variable to set data so that I can obtain the same result as directly setting "Test" with setData?

 

Title = "Test";
C1 = Tree Node( Title );
C1 << SetData( {Title, "", 1} );
Show( C1 << Get Data );
Show(( C1 << Get Data )[1] );

C2 = Tree Node( "Test2" );
C2 << SetData( {"Test2", "", 1} );
Show( C2 << Get Data );
Show( (C2 << Get Data) [1] );
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Using Character Variables with SetData in Tree Nodes

You will have to evaluate the list, for example

Names Default To Here(1);

Title = "Test";
C1 = Tree Node(Title);
C1 << SetData(Eval List({Title, "", 1}));
Show(C1 << Get Data);
// C1 << Get Data = {"Test", "", 1};
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Using Character Variables with SetData in Tree Nodes

You will have to evaluate the list, for example

Names Default To Here(1);

Title = "Test";
C1 = Tree Node(Title);
C1 << SetData(Eval List({Title, "", 1}));
Show(C1 << Get Data);
// C1 << Get Data = {"Test", "", 1};
-Jarmo
BabyDoragon
Level I

Re: Using Character Variables with SetData in Tree Nodes

 
Thank you for swiftly and accurately resolving the issue I encountered.