<?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: How can I create a column switcher in a final merged data table from a list variable created in one of the source tables? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870112#M103317</link>
    <description>&lt;P&gt;In that case I consider building the column list dynamically within the table script &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 = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

table_script_expr = Expr(
	cols = Current Data Table() &amp;lt;&amp;lt; Get Column Names();
	Remove From(cols, 1); // drop first column
	gb = Graph Builder(
		Size(528, 448),
		Show Control Panel(0),
		Variables(X(:lot_id), Y(Eval(cols[1]))),
		Elements(Points(X, Y, Legend(3)))
	);
	gb &amp;lt;&amp;lt; Column Switcher(
		cols[1],
		Remove(cols, 1)
	)
);

Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Script("Graph",
		Expr(NameExpr(table_script_expr))
	);	
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can avoid evaluation if you just create the graph and save that as script (I use this "trick" quite often)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

cols = dt &amp;lt;&amp;lt; Get Column Names();
Remove From(cols, 1); // drop first column

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(528, 448),
	Show Control Panel(0),
	Variables(X(:lot_id), Y(Eval(cols[1]))),
	Elements(Points(X, Y, Legend(3))),
	Column Switcher(
		cols[1],
		Remove(cols, 1)
	),
	Invisible
);
gb &amp;lt;&amp;lt; Save Script to Data Table("Graph"); // this will remove the need for evaluation 
wait(0);
gb &amp;lt;&amp;lt; close window;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and if you wish to evaluate&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// If you wish to evaluate, this should work even though the script will look a bit weird due to lack of ":" in columns
// If it doesn't you for some reason, you will have to build the list in a bit different manner for evaluation
Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Script("Graph2", 
		Graph Builder(
			Size(528, 448),
			Show Control Panel(0),
			Variables(X(:lot_id), Y(Expr(cols[1]))),
			Elements(Points(X, Y, Legend(3))),
			Column Switcher(
				Expr(cols[1]),
				Expr(Remove(cols, 1))
			)
		)
	)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Apr 2025 17:46:35 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-04-24T17:46:35Z</dc:date>
    <item>
      <title>How can I create a column switcher in a final merged data table from a list variable created in one of the source tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/869988#M103301</link>
      <description>&lt;P&gt;I have two data sources that being updated on a regular basis, resulting in new columns.&amp;nbsp; These are are merged via JSL scripting which works well but, I'd like to embed a graph with a column switcher that grows as more columns are added.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, say HPLC data comes from Instrument A and Instrument B.&amp;nbsp; Each column is a separate sample, with more samples being added over time.&amp;nbsp; I'd like to create a simple XY chart in the final data table for my 'A' samples, so that as more columns are added, the column switcher grows as well.&amp;nbsp; (Similar with B and even C, if a third instrument is added later).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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="fkp_0-1745489995540.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/75149i1F5830F1395B59BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fkp_0-1745489995540.png" alt="fkp_0-1745489995540.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've created a variable from the A table before I merge the data with B, but how can I pass the list (or evaluate it ) so that the final table recognizes the variable or has explicit column names?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;A_columns = dt_A &amp;lt;&amp;lt;Get Column Names();&lt;BR /&gt;&lt;BR /&gt;//Merge A and B based on time column&lt;BR /&gt;&lt;BR /&gt;Final_Table =dt_B &amp;lt;&amp;lt; Update(&lt;BR /&gt;With(dt_A)),&lt;BR /&gt;Match Columns( :Time = :Time)&lt;BR /&gt;);&lt;BR /&gt;Final_Table&amp;nbsp;&amp;lt;&amp;lt;New Script("Graph",&lt;BR /&gt;Graph Builder(&lt;BR /&gt;Size( 546, 565 ),&lt;BR /&gt;Show Control Panel( 0 ),&lt;BR /&gt;Variables( X( :Time ), Y( A_columns[1] ) ),&lt;BR /&gt;Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),&lt;BR /&gt;Column Switcher( A_columns[1], A_columns)&lt;BR /&gt;);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;This seems to work well when I obtain a list of columns from the final table, but trying to use a variable created from another table is causing issues.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 10:44:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/869988#M103301</guid>
      <dc:creator>fkp</dc:creator>
      <dc:date>2025-04-24T10:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a column switcher in a final merged data table from a list variable created in one of the source tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870017#M103302</link>
      <description>&lt;P&gt;Do you always wish to use all expect for the first column (:Time) in the column switcher?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 11:27:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870017#M103302</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-04-24T11:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a column switcher in a final merged data table from a list variable created in one of the source tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870022#M103303</link>
      <description>&lt;P&gt;In this case yes - always the first column which will always have the same name.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 11:59:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870022#M103303</guid>
      <dc:creator>fkp</dc:creator>
      <dc:date>2025-04-24T11:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a column switcher in a final merged data table from a list variable created in one of the source tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870112#M103317</link>
      <description>&lt;P&gt;In that case I consider building the column list dynamically within the table script &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 = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

table_script_expr = Expr(
	cols = Current Data Table() &amp;lt;&amp;lt; Get Column Names();
	Remove From(cols, 1); // drop first column
	gb = Graph Builder(
		Size(528, 448),
		Show Control Panel(0),
		Variables(X(:lot_id), Y(Eval(cols[1]))),
		Elements(Points(X, Y, Legend(3)))
	);
	gb &amp;lt;&amp;lt; Column Switcher(
		cols[1],
		Remove(cols, 1)
	)
);

Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Script("Graph",
		Expr(NameExpr(table_script_expr))
	);	
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can avoid evaluation if you just create the graph and save that as script (I use this "trick" quite often)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

cols = dt &amp;lt;&amp;lt; Get Column Names();
Remove From(cols, 1); // drop first column

gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(528, 448),
	Show Control Panel(0),
	Variables(X(:lot_id), Y(Eval(cols[1]))),
	Elements(Points(X, Y, Legend(3))),
	Column Switcher(
		cols[1],
		Remove(cols, 1)
	),
	Invisible
);
gb &amp;lt;&amp;lt; Save Script to Data Table("Graph"); // this will remove the need for evaluation 
wait(0);
gb &amp;lt;&amp;lt; close window;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and if you wish to evaluate&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// If you wish to evaluate, this should work even though the script will look a bit weird due to lack of ":" in columns
// If it doesn't you for some reason, you will have to build the list in a bit different manner for evaluation
Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Script("Graph2", 
		Graph Builder(
			Size(528, 448),
			Show Control Panel(0),
			Variables(X(:lot_id), Y(Expr(cols[1]))),
			Elements(Points(X, Y, Legend(3))),
			Column Switcher(
				Expr(cols[1]),
				Expr(Remove(cols, 1))
			)
		)
	)
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 17:46:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870112#M103317</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-04-24T17:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a column switcher in a final merged data table from a list variable created in one of the source tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870526#M103391</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 11:52:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-create-a-column-switcher-in-a-final-merged-data-table/m-p/870526#M103391</guid>
      <dc:creator>fkp</dc:creator>
      <dc:date>2025-04-28T11:52:39Z</dc:date>
    </item>
  </channel>
</rss>

