cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

Using Character Variables with SetData in Tree Nodes

BabyDoragon
Level II

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 II


Re: Using Character Variables with SetData in Tree Nodes

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