<?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: Add reference line from the reference table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/515305#M74196</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I tired your code on overlay plots but there's seems to an error. Any suggestions?&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("Data table.jmp"); // Open data table
// dt1 = Open("Reference table.jmp");

// Loop to get column name Currents and Voltages
colist = {};
Col_List = dt &amp;lt;&amp;lt; Get Column Names("String");
	
For(q = 1, q &amp;lt;= N Items(Col_List), q++, 
	If(Contains(Col_List[q], "Current") | Contains(Col_List[q], "Voltage"),
		Column(Col_List[q]) &amp;lt;&amp;lt; Set Selected(1);
		Insert Into(colist, Col_List[q]);
	)
);
	// Overlay Plot

		vc = dt2 &amp;lt;&amp;lt; Overlay Plot( Y( Eval( colist ) ), No Overlay( 1 ),Ungroup Plots( 1 ) );
									
aa_refs = Associative Array(dt1:Tests &amp;lt;&amp;lt; get values, dt1:Reference &amp;lt;&amp;lt; get values);
// Loop to add reference line to the variability chart
For(i = 1, i &amp;lt;= N Items(colist), i++,
	If(Contains(aa_refs, colist[i]),
		Report(vc[i])[Framebox(1)] &amp;lt;&amp;lt; DispatchSeg(CustomStreamSeg(3), {Line Width(2)});
		Report(vc[i])[AxisBox(1)] &amp;lt;&amp;lt; {Add Ref Line(aa_refs[colist[i]], "Solid", "Green", "RTS", 2)};
	);
);&lt;/CODE&gt;&lt;/PRE&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="Jacksmith12_0-1656458505208.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/43662iE66B766A1B713B95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jacksmith12_0-1656458505208.png" alt="Jacksmith12_0-1656458505208.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jun 2022 23:22:00 GMT</pubDate>
    <dc:creator>Jackie_</dc:creator>
    <dc:date>2022-06-28T23:22:00Z</dc:date>
    <item>
      <title>Add reference line from the reference table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/511642#M73943</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a variability plot graph and add a reference lines with different values for each of the individual charts. Currently I can plot the reference line but the problem is if the reference table doesn't contain all the test columns from the data table, the script won't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I tried and it works if the reference table has all the tests from the data table:&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 Globals();


dt = Open("Data table.jmp"); // Open data table

// Loop to get column name Currents and Voltages
colist = {};
Col_List = dt &amp;lt;&amp;lt; Get Column Names( "String" );
	
	For( q = 1, q &amp;lt;= N Items( Col_List ), q++, 
				
		If( Contains( Col_List[q], "Current" ) | Contains( Col_List[q], "Voltage" ),
			Column( Col_List[q] ) &amp;lt;&amp;lt; Set Selected( 1 );
			Insert Into( colist, Col_List[q] );
		)
	);
	// Var Chart
	vc= dt &amp;lt;&amp;lt; Variability Chart(
								Y( (Eval( colist )) ),
								X( :Wafer ID ),
								Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
								Show Range Bars( 0 ),
								Std Dev Chart( 0 ),
								Points Jittered( 1 )
							
							);&lt;BR /&gt;// Reference data table
dt1 = Open ("Reference table.jmp");
xb = Column(dt1, "Reference") &amp;lt;&amp;lt; getValues;
// Loop to add reference line to the variability chart 
	For( i = 1, i &amp;lt;= N Items( vc ), i++,
		Report( vc[i] )[Framebox( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
		Report( vc[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line( xb[i], "Solid", "Green", "RTS", 2 )};
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:01:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/511642#M73943</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2023-06-09T17:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add reference line from the reference table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/511679#M73946</link>
      <description>&lt;P&gt;You could loop over colist and check if dt1 has that specific value with if statement and if it does then add reference line based on value found from dt1. Here is one option using Associative Array (you might have to add scaling to Y-axis for the variability charts, as reference lines can be hidden depending on their value).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

// dt = Open("Data table.jmp"); // Open data table
// dt1 = Open("Reference table.jmp");

// Loop to get column name Currents and Voltages
colist = {};
Col_List = dt &amp;lt;&amp;lt; Get Column Names("String");
	
For(q = 1, q &amp;lt;= N Items(Col_List), q++, 
	If(Contains(Col_List[q], "Current") | Contains(Col_List[q], "Voltage"),
		Column(Col_List[q]) &amp;lt;&amp;lt; Set Selected(1);
		Insert Into(colist, Col_List[q]);
	)
);
	// Var Chart
vc = dt &amp;lt;&amp;lt; Variability Chart(
	Y((Eval(colist))),
	X(:Wafer ID),
	Analysis Type("Choose best analysis (EMS REML Bayesian)"),
	Show Range Bars(0),
	Std Dev Chart(0),
	Points Jittered(1)	
);// Reference data table

aa_refs = Associative Array(dt1:Tests &amp;lt;&amp;lt; get values, dt1:Reference &amp;lt;&amp;lt; get values);
// Loop to add reference line to the variability chart
For(i = 1, i &amp;lt;= N Items(colist), i++,
	If(Contains(aa_refs, colist[i]),
		Report(vc[i])[Framebox(1)] &amp;lt;&amp;lt; DispatchSeg(CustomStreamSeg(3), {Line Width(2)});
		Report(vc[i])[AxisBox(1)] &amp;lt;&amp;lt; {Add Ref Line(aa_refs[colist[i]], "Solid", "Green", "RTS", 2)};
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jun 2022 18:42:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/511679#M73946</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-06-21T18:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add reference line from the reference table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/511684#M73947</link>
      <description>&lt;P&gt;Here is a slightly different solution, reading the reference table directly&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Clear Globals();


//dt = Open( "Data table.jmp" ); // Open data table
dt = Data Table( "data table" );

// Loop to get column name Currents and Voltages
colist = {};
Col_List = dt &amp;lt;&amp;lt; Get Column Names( "String" );
	
For( q = 1, q &amp;lt;= N Items( Col_List ), q++, 
				
	If( Contains( Col_List[q], "Current" ) | Contains( Col_List[q], "Voltage" ),
		Column( Col_List[q] ) &amp;lt;&amp;lt; Set Selected( 1 );
		Insert Into( colist, Col_List[q] );
	)
);
	// Var Chart
vc = dt &amp;lt;&amp;lt; Variability Chart(
	Y( (Eval( colist )) ),
	X( :Wafer ID ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Show Range Bars( 0 ),
	Std Dev Chart( 0 ),
	Points Jittered( 1 )
							
);// Reference data table
//dt1 = Open( "Reference table.jmp" );
dt1 = Data Table( "reference table" );
xb = Column( dt1, "Reference" ) &amp;lt;&amp;lt; getValues;
// Loop to add reference line to the variability chart 
For( i = 1, i &amp;lt;= N Items( vc ), i++, 
	//Report( vc[i] )[Framebox( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
	testVal = Word( -2, Report( vc[i] )[Outline Box( 2 )] &amp;lt;&amp;lt; get title, " " ) || " " || Word(
		-1,
		Report( vc[i] )[Outline Box( 2 )] &amp;lt;&amp;lt; get title,
		" "
	);
	testRow = dt1 &amp;lt;&amp;lt; get rows where( :tests == testVal );
	If( N Rows( testRow ) &amp;gt; 0,
		Report( vc[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; Add Ref Line( dt1:Reference[testRow[1]], "Solid", "Green", "RTS", 2 )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jun 2022 18:53:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/511684#M73947</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-06-21T18:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Add reference line from the reference table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/515305#M74196</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I tired your code on overlay plots but there's seems to an error. Any suggestions?&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("Data table.jmp"); // Open data table
// dt1 = Open("Reference table.jmp");

// Loop to get column name Currents and Voltages
colist = {};
Col_List = dt &amp;lt;&amp;lt; Get Column Names("String");
	
For(q = 1, q &amp;lt;= N Items(Col_List), q++, 
	If(Contains(Col_List[q], "Current") | Contains(Col_List[q], "Voltage"),
		Column(Col_List[q]) &amp;lt;&amp;lt; Set Selected(1);
		Insert Into(colist, Col_List[q]);
	)
);
	// Overlay Plot

		vc = dt2 &amp;lt;&amp;lt; Overlay Plot( Y( Eval( colist ) ), No Overlay( 1 ),Ungroup Plots( 1 ) );
									
aa_refs = Associative Array(dt1:Tests &amp;lt;&amp;lt; get values, dt1:Reference &amp;lt;&amp;lt; get values);
// Loop to add reference line to the variability chart
For(i = 1, i &amp;lt;= N Items(colist), i++,
	If(Contains(aa_refs, colist[i]),
		Report(vc[i])[Framebox(1)] &amp;lt;&amp;lt; DispatchSeg(CustomStreamSeg(3), {Line Width(2)});
		Report(vc[i])[AxisBox(1)] &amp;lt;&amp;lt; {Add Ref Line(aa_refs[colist[i]], "Solid", "Green", "RTS", 2)};
	);
);&lt;/CODE&gt;&lt;/PRE&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="Jacksmith12_0-1656458505208.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/43662iE66B766A1B713B95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jacksmith12_0-1656458505208.png" alt="Jacksmith12_0-1656458505208.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 23:22:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/515305#M74196</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2022-06-28T23:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Add reference line from the reference table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/515322#M74198</link>
      <description>&lt;P&gt;There are a couple of issues.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Different platforms have different Tree Structures because they have different output structures.&amp;nbsp; Therefore the mapping to the different objects within the output is different.&lt;/LI&gt;
&lt;LI&gt;You specify dt as the pointer to the "Data table", but later in the script, you attempt to execute the Overlay Plot, pointing to a data table referenced by a variable dt2, that does not exist in your code.&lt;/LI&gt;
&lt;LI&gt;In you code that creates the Associative Array, you use a variable from your Reference Data Table, called Reference.&amp;nbsp; In the sample data you provided in the Optimize Loop Discussion, the variable in that data table is called Mean.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Below is a modification of your code that produces the following output&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1656463531476.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/43665i903C44E915D39CA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1656463531476.png" alt="txnelson_0-1656463531476.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

// dt = Open("Data table.jmp"); // Open data table
dt=data table("Data Table");
// dt1 = Open("Reference table.jmp");
dt1=data table("Reference data table");
// Loop to get column name Currents and Voltages
colist = {};
Col_List = dt &amp;lt;&amp;lt; Get Column Names("String");
	
For(q = 1, q &amp;lt;= N Items(Col_List), q++, 
	If(Contains(Col_List[q], "Current") | Contains(Col_List[q], "Voltage"),
		Column(Col_List[q]) &amp;lt;&amp;lt; Set Selected(1);
		Insert Into(colist, Col_List[q]);
	)
);
	// Overlay Plot

		vc = dt &amp;lt;&amp;lt; Overlay Plot( Y( Eval( colist ) ), No Overlay( 1 ),Ungroup Plots( 1 ) );
									
aa_refs = Associative Array(dt1:Tests &amp;lt;&amp;lt; get values, dt1:mean &amp;lt;&amp;lt; get values);
// Loop to add reference line to the variability chart
For(i = 14, i &amp;lt;= N Items(colist), i++,
	If(Contains(aa_refs, colist[i]),
		Report(vc)[AxisBox(1)] &amp;lt;&amp;lt; Add Ref Line(aa_refs[colist[i]], "Solid", "Green", "RTS", 2);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please take the time to read up on Display Trees in the Scripting Guide, available in the JMP Documentation Library, under the Help pull down menu.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 00:48:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-from-the-reference-table/m-p/515322#M74198</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-06-29T00:48:15Z</dc:date>
    </item>
  </channel>
</rss>

