<?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: [JSL] Add more info to Columns in a List Box () in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798936#M97492</link>
    <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;YES!, the command&amp;nbsp;&lt;SPAN&gt;&amp;lt;&amp;lt; &lt;/SPAN&gt;set scrollable&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0 &lt;/SPAN&gt;&lt;SPAN&gt;); solve my issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks so much!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Julien&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Sep 2024 04:26:39 GMT</pubDate>
    <dc:creator>Voizingu</dc:creator>
    <dc:date>2024-09-15T04:26:39Z</dc:date>
    <item>
      <title>[JSL] Add more info to Columns in a List Box ()</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798728#M97475</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to display a New Window() to request the user to select some categorical factors from a data table in a List Box().&lt;/P&gt;&lt;P&gt;I would like to add more insight to this choice, by highlighting:&lt;/P&gt;&lt;P&gt;- the number of level for each factors&lt;/P&gt;&lt;P&gt;- a color to show the ratio of empty cells within each factors columns&lt;/P&gt;&lt;P&gt;see attached an example of what I would like to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the following script, I calculate the info for each factor and populate a list &lt;SPAN&gt;"Value"&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;But then I don't know how to aproach the design of the List Box () with these infos&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- voiz&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68286iED2C03AA12D41113/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
clear symbols();
Deletesymbols();

dt = New Table( "RawData",
	Add Rows( 20 ),
	New Column("factor1", Character, set values( {"A","A","A","A","A","A","A","B","B","B","B","B","B","C","C","C","C","C","C","C"})),
	New Column("factor2", Character, set values( {"T0","DROP1","DROP2","DROP3","DROP4","DROP5","DROP6","T0","DROP1","DROP2","DROP3","DROP4","DROP5","T0","DROP1","DROP2","DROP3","DROP4","DROP5", "DROP6"})),
	New Column("factor3", Character, set values({"1","1","1","2","2","", ,"","","" ,"" ,"", "","3","3","3","3"}) ),
	New Column("factor4", Character, set values({"a","a","a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b" , "b", "b", "b", "b"}) );
	);

RawDataCol = dt &amp;lt;&amp;lt; get column names ("character");
show (RawDataCol);

for(i=1, i&amp;lt;= N items (RawDataCol), i++,
	FactorSummary = {};
	Eval(Eval Expr(FactorSummary = Column(dt, Expr(char(RawDataCol[i]))) &amp;lt;&amp;lt; get values));
	//show (FactorSummary);
	
	//find cell count (non empty)
	Eval(Eval Expr(For( j = N Items(FactorSummary), j &amp;gt; 0, j--,
		If( FactorSummary[j] == "",
			Remove From( FactorSummary, j, 1 )
		)
	)));
	
	//Find number of level within a factor (non empty)
	Eval(Eval Expr(Summarize( LevelSummary = by(Column(dt, Expr(char(RawDataCol[i])))) )));
		Eval(Eval Expr(For( j = N Items(LevelSummary), j &amp;gt; 0, j--,
		If( LevelSummary[j] == "",
			Remove From( LevelSummary, j, 1 )
		)
	)));
	//show (LevelSummary);
	
	Eval(Eval Expr(Value = {Expr(RawDataCol[i]), Expr(N items(LevelSummary)), Expr(N items (FactorSummary) / N row(dt))}));
	show (Value);
);

MainWindow = New Window( "Select Factors",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;ReturnResult,
		V List Box(Align(center),
			Panel Box( "Select factors to run the analysis", 
				Lineup Box( N Col( 2 ), Spacing( 5 ), 
				PickData = List Box( RawDataCol ) ) )
));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Sep 2024 17:44:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798728#M97475</guid>
      <dc:creator>Voizingu</dc:creator>
      <dc:date>2024-09-13T17:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: [JSL] Add more info to Columns in a List Box ()</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798880#M97487</link>
      <description>&lt;P&gt;I would change from using a list box to using a Table Box which will allow you to have multiple columns displayed&lt;/P&gt;
&lt;P&gt;Using different colors for different rows will remain an issue, however you can easily add in a column that you can have that has 1, 2, etc "*" to indicate different levels.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 11:24:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798880#M97487</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-09-14T11:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: [JSL] Add more info to Columns in a List Box ()</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798894#M97488</link>
      <description>&lt;P&gt;List Box isn't the most flexible display box and I agree with txnelson that that you could use Table Box. Below is one example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("RawData",
	Add Rows(20),
	New Column("factor1",
		Character,
		set values({"A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C", "C"})
	),
	New Column("factor2",
		Character,
		set values(
			{"T0", "DROP1", "DROP2", "DROP3", "DROP4", "DROP5", "DROP6", "T0", "DROP1", "DROP2", "DROP3", "DROP4", "DROP5", "T0", "DROP1", "DROP2",
			"DROP3", "DROP4", "DROP5", "DROP6"}
		)
	),
	New Column("factor3", Character, set values({"1", "1", "1", "2", "2", "", , "", "", "", "", "", "", "3", "3", "3", "3"})),
	New Column("factor4", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"}))
);

cols = dt &amp;lt;&amp;lt; get column names("character", "string");
factors = {};
factor_counts = {};
missing_perc = {};

For Each({colname}, cols,
	Summarize(dt, uniq = by(Eval(colname)));
	Remove From(uniq, Contains(uniq, ""));
	nvalues = Col Number(Column(dt, colname));
	Insert Into(factors, colname);
	Insert Into(factor_counts, N Items(uniq));
	Insert Into(missing_perc, (nvalues)/ N Rows(dt));
);

dt_factors = New Table("Demo",
	Add Rows(N Items(factors)),
	New Column("Factor", Character, Nominal, Values(factors)),
	New Column("Count", Numeric, Continuous, Values(factor_counts)),
	New Column("% Non-missing", Numeric, Continuous, Format("Percent", 12, 3), Values(missing_perc)),
	Invisible
);

orange_rows = dt_factors &amp;lt;&amp;lt; Get Rows Where(:"% Non-missing"n &amp;lt; 0.5);
yellow_rows = dt_factors &amp;lt;&amp;lt; Get Rows Where(0.5 &amp;lt; :"% Non-missing"n &amp;lt; 0.9);

For Each({colname}, dt_factors &amp;lt;&amp;lt; Get Column Names("String"),
	Column(dt_factors, colname) &amp;lt;&amp;lt; Color Cells("Green");
	Column(dt_factors, colname) &amp;lt;&amp;lt; Color Cells("Orange", orange_rows);
	Column(dt_factors, colname) &amp;lt;&amp;lt; Color Cells("Yellow", yellow_rows);
);

nw = New Window("Select",
	H List Box(
		Panel Box("Select factors to run the analysis",
			bb = dt_factors &amp;lt;&amp;lt; get as report
		),
		Panel Box("Actions",
			Lineup Box(N Col(1),
				Button Box("OK",
					tb = bb &amp;lt;&amp;lt; child;
					sel_rows = tb &amp;lt;&amp;lt; get selected rows;
					show(sel_rows, tb[1][sel_rows]);
				),
				Button Box("Cancel", &amp;lt;&amp;lt; Set Function(function({this}, this &amp;lt;&amp;lt; close window))),
			)
		)
	)
);


Close(dt_factors, no save);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1726335238797.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68307i8F3AD2C7378A693A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1726335238797.png" alt="jthi_1-1726335238797.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2024 17:34:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798894#M97488</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-14T17:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: [JSL] Add more info to Columns in a List Box ()</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798898#M97490</link>
      <description>&lt;P&gt;Hi Jarmo,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I like this solution a lot (Thanks also Jim for the suggestion).&lt;/P&gt;&lt;P&gt;One thing I need to take in account is the fact that I might have multiple dozen of factors.&lt;BR /&gt;Is there a way to force a fixed height for Table Box() ?&lt;/P&gt;&lt;P&gt;For instance, only 5 visible row and the ability to scroll down to have a fixed height in order to add more user inputs (radio box, check box, etc...).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below an example of Table Box () with more rows and all of them are visible (it will become an issue with much more factors)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 822px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68309i215B5BDA35B30FA4/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("RawData",
	Add Rows(20),
	New Column("factor1",
		Character,
		set values({"A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C", "C"})
	),
	New Column("factor2",
		Character,
		set values(
			{"T0", "DROP1", "DROP2", "DROP3", "DROP4", "DROP5", "DROP6", "T0", "DROP1", "DROP2", "DROP3", "DROP4", "DROP5", "T0", "DROP1", "DROP2",
			"DROP3", "DROP4", "DROP5", "DROP6"}
		)
	),
	New Column("factor3", Character, set values({"1", "1", "1", "2", "2", "", , "", "", "", "", "", "", "3", "3", "3", "3"})),
	New Column("factor4", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor5", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor6", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor7", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor8", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor9", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor10", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor12", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor13", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factorA", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factorB", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factorB1", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factorC", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factorD", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor69", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor67", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor47", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"})),
	New Column("factor56", Character, set values({"a", "a", "a", "", "", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b"}))
);

cols = dt &amp;lt;&amp;lt; get column names("character", "string");
factors = {};
factor_counts = {};
missing_perc = {};

For Each({colname}, cols,
	Summarize(dt, uniq = by(Eval(colname)));
	Remove From(uniq, Contains(uniq, ""));
	nvalues = Col Number(Column(dt, colname));
	Insert Into(factors, colname);
	Insert Into(factor_counts, N Items(uniq));
	Insert Into(missing_perc, (nvalues)/ N Rows(dt));
);

dt_factors = New Table("Demo",
	Add Rows(N Items(factors)),
	New Column("Factor", Character, Nominal, Values(factors)),
	New Column("Count", Numeric, Continuous, Values(factor_counts)),
	New Column("% Non-missing", Numeric, Continuous, Format("Percent", 12, 3), Values(missing_perc)),
	Invisible
);

orange_rows = dt_factors &amp;lt;&amp;lt; Get Rows Where(:"% Non-missing"n &amp;lt; 0.5);
yellow_rows = dt_factors &amp;lt;&amp;lt; Get Rows Where(0.5 &amp;lt; :"% Non-missing"n &amp;lt; 0.9);

For Each({colname}, dt_factors &amp;lt;&amp;lt; Get Column Names("String"),
	Column(dt_factors, colname) &amp;lt;&amp;lt; Color Cells("Green");
	Column(dt_factors, colname) &amp;lt;&amp;lt; Color Cells("Orange", orange_rows);
	Column(dt_factors, colname) &amp;lt;&amp;lt; Color Cells("Yellow", yellow_rows);
);

nw = New Window("Select",
	H List Box(
		Panel Box("Select factors to run the analysis",
			bb = dt_factors &amp;lt;&amp;lt; get as report
		),
		Panel Box("Actions",
			Lineup Box(N Col(1),
				Button Box("OK",
					tb = bb &amp;lt;&amp;lt; child;
					sel_rows = tb &amp;lt;&amp;lt; get selected rows;
					show(sel_rows, tb[1][sel_rows]);
				),
				Button Box("Cancel", &amp;lt;&amp;lt; Set Function(function({this}, this &amp;lt;&amp;lt; close window))),
			)
		)
	)
);


Close(dt_factors, no save);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Sep 2024 19:35:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798898#M97490</guid>
      <dc:creator>Voizingu</dc:creator>
      <dc:date>2024-09-14T19:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: [JSL] Add more info to Columns in a List Box ()</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798935#M97491</link>
      <description>&lt;P&gt;look in the scripting index and search on table box and you will see the examples on how to set the number of display lines&lt;/P&gt;</description>
      <pubDate>Sun, 15 Sep 2024 01:28:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798935#M97491</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-09-15T01:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: [JSL] Add more info to Columns in a List Box ()</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798936#M97492</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;YES!, the command&amp;nbsp;&lt;SPAN&gt;&amp;lt;&amp;lt; &lt;/SPAN&gt;set scrollable&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0 &lt;/SPAN&gt;&lt;SPAN&gt;); solve my issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks so much!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Julien&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Sep 2024 04:26:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Add-more-info-to-Columns-in-a-List-Box/m-p/798936#M97492</guid>
      <dc:creator>Voizingu</dc:creator>
      <dc:date>2024-09-15T04:26:39Z</dc:date>
    </item>
  </channel>
</rss>

