<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Exploring Keyword Search Methods for Tree Box Items in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Exploring-Keyword-Search-Methods-for-Tree-Box-Items/m-p/870223#M103340</link>
    <description>&lt;DIV class="forum-subj-action"&gt;
&lt;DIV class="lia-message-subject lia-component-message-view-widget-subject"&gt;
&lt;DIV class="MessageSubject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="forum-author"&gt;
&lt;DIV class="author-20"&gt;&lt;LI-MESSAGE title="Searching elements in Tree box" uid="867118" url="https://community.jmp.com/t5/Discussions/Searching-elements-in-Tree-box/m-p/867118#U867118" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;is this same topic?&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 25 Apr 2025 09:36:38 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-04-25T09:36:38Z</dc:date>
    <item>
      <title>Exploring Keyword Search Methods for Tree Box Items</title>
      <link>https://community.jmp.com/t5/Discussions/Exploring-Keyword-Search-Methods-for-Tree-Box-Items/m-p/867014#M102978</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I hope to be able to search the contents of the Tree box. In the List box's state as shown in the JSL, it is easy to perform a keyword search. However, it's not as straightforward with the Tree box. Could you please let me know what methods can be used to implement keyword searching for items in the Tree box?&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=New Table( "Food Tree",
	Add Rows( 8 ),
	New Column( "Name",
		Character,
		"Nominal",
		Set Selected,
		Set Values(
			{"Apple", "Banana", "Watermelon", "Fruit", "Broccoli", "Lettuce",
			"Potato", "Vegetable"}
		)
	),
	New Column( "Category",
		Character,
		"Nominal",
		Set Values(
			{"Fruit", "Fruit", "Fruit", "", "Vegetable", "Vegetable", "Vegetable",
			""}
		)
	),
	New Column( "Level",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [2, 2, 2, 1, 2, 2, 2, 1] )
	),
	Set Row States( [0, 0, 0, 1, 0, 0, 0, 0] )
);

relations = [=&amp;gt;];
For Each Row( dt,
	relations[:Name] = Tree Node( :Name );
	relations[:Name] &amp;lt;&amp;lt;Set Data( Eval List( {:Name, :Category,  :Level} ) );
);
roots = {};
For Each Row( dt,
	If( :Category != "" &amp;amp; relations &amp;lt;&amp;lt; Contains( :Category ),
		relations[:Category] &amp;lt;&amp;lt; Append( relations[:Name] )
	,
		roots[N Items( roots ) + 1] = relations[:Name]
	);
);

New Window( "TreeBox Tests", hlistbox(
		icon box("SearchIndex"),
		spacer box(size(5, 10)),
		item_search_teb = text edit box("", 
				&amp;lt;&amp;lt; set width(300),
// The filter_items function does the work
				&amp;lt;&amp;lt; set text changed(filter_items)),
		reset_button = button box("", 
				&amp;lt;&amp;lt; set icon("DebuggerDeleteBreakpoint"),
				&amp;lt;&amp;lt; set script(
// Clear the filter and call the callback function
				item_search_teb &amp;lt;&amp;lt; set text("");
				filter_items(item_search_teb, "");
				),
				&amp;lt;&amp;lt; set tip("Clear filter"),
		),
	),
	tree = Tree Box( roots, Size( 300, 500 ) ) );

key = relations &amp;lt;&amp;lt; First;
While( !Is Empty( key ),
	Try( tree &amp;lt;&amp;lt; Expand( relations[key] ) );
	key = relations &amp;lt;&amp;lt; Next( key )
);
tree &amp;lt;&amp;lt; Set Node Select Script(
	Function( {this, node},
		Print( node &amp;lt;&amp;lt; Get Data )
	)
);

filter_items = Function( {this, searchText},
	{filtered_items, i},
	// only attempt to filter if there is any text
	If( searchText != "",
		// new list for groups that match searchText
		filtered_items = {};
		// Check if each group matches the given text
		For( i = 1, i &amp;lt;= N Items( item_list ), i++,
			// Insert to our list if it contains our search text (case insensitive)
			If( Contains( Lowercase( item_list[i] ), Lowercase( searchText ) ),
				Insert Into( filtered_items, item_list[i] );
			)
		);
		,
	// else show all groups
		filtered_items = item_list;
	);
	item_disp_box &amp;lt;&amp;lt; Set Items( filtered_items );
);		// end filter_items function

item_list = {"Apple", "Banana", "Watermelon", "Broccoli", "Lettuce", "Potato"};

nw = new window("Demonstrate Listbox Search",
	hlistbox(
		icon box("SearchIndex"),
		spacer box(size(5, 10)),
		item_search_teb = text edit box("", 
				&amp;lt;&amp;lt; set width(300),
// The filter_items function does the work
				&amp;lt;&amp;lt; set text changed(filter_items)),
		reset_button = button box("", 
				&amp;lt;&amp;lt; set icon("DebuggerDeleteBreakpoint"),
				&amp;lt;&amp;lt; set script(
// Clear the filter and call the callback function
				item_search_teb &amp;lt;&amp;lt; set text("");
				filter_items(item_search_teb, "");
				),
				&amp;lt;&amp;lt; set tip("Clear filter"),
		),
	),
	panelbox("Select a state:",
		item_disp_box = listbox(item_list, width(200), nlines(10)),
	),
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Apr 2025 01:16:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Exploring-Keyword-Search-Methods-for-Tree-Box-Items/m-p/867014#M102978</guid>
      <dc:creator>BabyDoragon</dc:creator>
      <dc:date>2025-04-09T01:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exploring Keyword Search Methods for Tree Box Items</title>
      <link>https://community.jmp.com/t5/Discussions/Exploring-Keyword-Search-Methods-for-Tree-Box-Items/m-p/870223#M103340</link>
      <description>&lt;DIV class="forum-subj-action"&gt;
&lt;DIV class="lia-message-subject lia-component-message-view-widget-subject"&gt;
&lt;DIV class="MessageSubject"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="forum-author"&gt;
&lt;DIV class="author-20"&gt;&lt;LI-MESSAGE title="Searching elements in Tree box" uid="867118" url="https://community.jmp.com/t5/Discussions/Searching-elements-in-Tree-box/m-p/867118#U867118" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;is this same topic?&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Apr 2025 09:36:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Exploring-Keyword-Search-Methods-for-Tree-Box-Items/m-p/870223#M103340</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-04-25T09:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Exploring Keyword Search Methods for Tree Box Items</title>
      <link>https://community.jmp.com/t5/Discussions/Exploring-Keyword-Search-Methods-for-Tree-Box-Items/m-p/870224#M103341</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Yes, it's the same. This post was blocked after it was published, and I don't know why. &lt;BR /&gt;Later it was unblocked, but I have already asked the question again.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2025 09:40:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Exploring-Keyword-Search-Methods-for-Tree-Box-Items/m-p/870224#M103341</guid>
      <dc:creator>BabyDoragon</dc:creator>
      <dc:date>2025-04-25T09:40:18Z</dc:date>
    </item>
  </channel>
</rss>

