<?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: Script to Colour Passing or Failing Cells in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/864927#M102838</link>
    <description>&lt;P&gt;There are plenty of examples in community where spec limits are used to color cells. There are also JMP platforms which can do the coloring based on spec limit column property.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Apr 2025 18:10:46 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-04-02T18:10:46Z</dc:date>
    <item>
      <title>Script to Colour Passing or Failing Cells</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/864908#M102837</link>
      <description>&lt;P&gt;Anyone ever generate a script to colour cells that pass&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

// Get all numeric columns
colList = dt &amp;lt;&amp;lt; get column names( numeric, string );

foundCols = "";

// Loop across the columns and generate the test pass/fails
Try(For( i = 1, i &amp;lt;= N Items( colList ), i++,
	spec = Column( dt, colList[i] ) &amp;lt;&amp;lt; get property( "Spec Limits" );
	//Establish the Notes Value from the Parent Column
	Notes = Column( dt, colList[i] ) &amp;lt;&amp;lt; get property( "Notes" );
	dt &amp;lt;&amp;lt; clear select;
	If( Is Empty( spec ) == 0,
		// Set Property("Notes", Notes), in the next line reattaches the Notes to the Child Column
		dt &amp;lt;&amp;lt; New Column( (Column( dt, colList[i] ) &amp;lt;&amp;lt; get name) || " Pass/Fail", Set Property("Notes", Notes) );
		
		// Select out of spec rows
		
		If( Is Missing( Try( spec["LSL"], . ) ) == 0,
			dt &amp;lt;&amp;lt; select where( As Column( dt, colList[i] ) &amp;lt; spec["LSL"] );
			Try( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] = 0 );
		);
		If( Is Missing( Try( spec["USL"], . ) ) == 0,
			dt &amp;lt;&amp;lt; select where( As Column( dt, colList[i] ) &amp;gt; spec["USL"], current selection( "extend" ) );
			Try( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] = 0 );
		);
			
		// Throw net to include missing cells
		
		dt &amp;lt;&amp;lt; select where( Is Missing( As Column( dt, colList[i] ) ), current selection( "extend" ) );
				
		// Invert Selection
		
		dt &amp;lt;&amp;lt; invert row selection;
		
		Try( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] = 1 );
		
		Column( dt, N Cols( dt ) ) &amp;lt;&amp;lt; set property( "Value Labels", {0 = "Fail", 1 = "Pass"} );
		If( foundCols == "",
			foundCols = ":Name(\!"" || (Column( dt, colList[i] ) &amp;lt;&amp;lt; get name) || " Pass/Fail\!")",
			foundCols = foundCols || ", " || ":Name(\!"" || (Column( dt, colList[i] ) &amp;lt;&amp;lt; get name) || " Pass/Fail\!")"
		);
	);
););

// Create the Row Pass/Fail
Eval( Parse( "dt &amp;lt;&amp;lt; New Column( \!"Row Pass/Fail\!", formula( If( Min(" || foundCols || " ) == 1, 1, 0 ) ))" ) );

dt = Current Data Table();

Grps = dt &amp;lt;&amp;lt; Get Column Groups Names;

For( j = 1, j &amp;lt;= N Items( Grps ), j++,
colrefs={};
colrefs = dt &amp;lt;&amp;lt; get column group(Grps[j]);

colnames = Transform Each({colref}, colrefs,
	 Head Name( As Namespace( colref )) ||" Pass/Fail"
);

show(colrefs, colnames);

Group = dt &amp;lt;&amp;lt; Group Columns(colnames);
dt &amp;lt;&amp;lt; rename column group( Group, Grps[j]||" Pass Fail" ););


Eval( Parse( "dt &amp;lt;&amp;lt; New Column( \!"Count Of Tests\!", formula( Number(" || foundCols || " ) ) ))" ) );
Eval( Parse( "dt &amp;lt;&amp;lt; New Column( \!"% Yield\!", formula( 100* Sum(" || foundCols || " ) / Number(" || foundCols || " ) ) ))" ) );
Eval(EvalExpr(dt &amp;lt;&amp;lt; New Column( "Process Script", Character, "Nominal", Formula(Expr(Char(Process_Script))))));


dt = Current Data Table();

colList = dt &amp;lt;&amp;lt; Get Column Names( String );

 
For( i = 1, i &amp;lt;= N Cols( dt ), i++,
	If( Contains( colList[i], "Pass/Fail" ), /* select only columns with Pass/Fail
	in the name */
		Column( colList[i] ) &amp;lt;&amp;lt; Set Property( "Value Colors", {0 = -13912408, 1 = 20} ) &amp;lt;&amp;lt; Color Cell by Value( 1 )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;spec vs fail?&amp;nbsp; I have a script that generates new grading columns but I wanted to affect the native columns.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 17:42:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/864908#M102837</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-04-02T17:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Colour Passing or Failing Cells</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/864927#M102838</link>
      <description>&lt;P&gt;There are plenty of examples in community where spec limits are used to color cells. There are also JMP platforms which can do the coloring based on spec limit column property.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 18:10:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/864927#M102838</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-04-02T18:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Colour Passing or Failing Cells</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/864993#M102840</link>
      <description>&lt;P&gt;Couldn't find any examples.&amp;nbsp; Not happy with the Manage Spec Limits colour scheme.&amp;nbsp; Did this instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

colList = dt &amp;lt;&amp;lt; get column names( numeric, string );

For( i = 1, i &amp;lt;= N Items( colList ), i++,
spec = Column( dt, colList[i] ) &amp;lt;&amp;lt; get property( "Spec Limits" );
fails = As List( dt &amp;lt;&amp;lt; get rows where( As Column(Column( dt, colList[i] )) &amp;lt; spec["LSL"] | As Column(Column( dt, colList[i] )) &amp;gt; spec["USL"] ) );
Column( dt, colList[i] ) &amp;lt;&amp;lt; color cells( "Red", fails );
passes = As List( dt &amp;lt;&amp;lt; get rows where( As Column(Column( dt, colList[i] )) &amp;gt; spec["LSL"] &amp;amp; As Column(Column( dt, colList[i] )) &amp;lt; spec["USL"] ) );
Column( dt, colList[i] ) &amp;lt;&amp;lt; color cells( "Green", passes );
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Apr 2025 21:18:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/864993#M102840</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-04-02T21:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Colour Passing or Failing Cells</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/865517#M102868</link>
      <description>&lt;P&gt;With&lt;LI-MESSAGE title="🙏 is in spec (value)" uid="774331" url="https://community.jmp.com/t5/JMP-Wish-List/is-in-spec-value/m-p/774331#U774331" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&amp;nbsp;it will get even easier to do the job :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 19:57:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/865517#M102868</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-04-04T19:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script to Colour Passing or Failing Cells</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/865834#M102886</link>
      <description>&lt;P&gt;hogi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For sure.&amp;nbsp; Meantime the script above works and is easy to do surgery on to repurpose for accounting or whatever.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2025 17:43:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-Colour-Passing-or-Failing-Cells/m-p/865834#M102886</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-04-07T17:43:46Z</dc:date>
    </item>
  </channel>
</rss>

