<?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 to get a pass_fail column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243919#M48122</link>
    <description>&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;I need to thank &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4386"&gt;@Byron_JMP&lt;/a&gt;&amp;nbsp;&amp;nbsp; for responding.&amp;nbsp; I had intended to respond to this discussion, and before I did, it moved on to an older page and thus it fell out of my memory.&amp;nbsp; Byron's response kicked the discussion back into my NameSpace.&amp;nbsp;&lt;BR /&gt;I believe all you have to do to fix your issue, is to validate that a given column has spec limits associated with it.&amp;nbsp; And, if no spec limits are found, then do not process that column.&amp;nbsp; Below is a somewhat cryptic suggested change that may do what you want.&amp;nbsp; The basics of the issue is to use an If() function to only process the code when the spec limits are found&amp;nbsp; This is a replacement for your current specs =&amp;nbsp; line of code&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;clear symbols(specs);
specs = Column( dt, colNamesList[theCol] ) &amp;lt;&amp;lt; get property( "spec limits" );
If(isEmpty(specs)==0,
	&amp;lt;all of the code to the end of the For loop
	);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 17:02:17 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-01-30T17:02:17Z</dc:date>
    <item>
      <title>How to get a pass_fail column</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243196#M47995</link>
      <description>&lt;P&gt;I'd like to get a pass_fail column, and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;made it to script.&lt;/P&gt;&lt;P&gt;But, t&lt;SPAN&gt;his script does not work if any of the many columns do not have a spec in the middle.&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i fix it?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dtOrig = current data table();

colNamesList = dtOrig &amp;lt;&amp;lt; get column names( continuous, string );

// Create a work table of just the continuous columns
dt = dtOrig &amp;lt;&amp;lt; subset( columns( colNamesList ), selected rows( 0 ) );

// Loop across all of the columns and apply a Range Check to eliminate
// all data outside of the upper and lower spec limits
For( theCol = 1, theCol &amp;lt;= N Items( colNamesList ), theCol++,
	specs = Column( dt, colNamesList[theCol] ) &amp;lt;&amp;lt; get property( "spec limits" );
	Eval(
		Substitute(
				Expr(
					Column( dt, colNamesList[theCol] ) &amp;lt;&amp;lt; set property(
						"Range Check",
						(LELE( __LSL__, __USL__ ))
					)
				),
			Expr( __LSL__ ), specs["LSL"],
			Expr( __USL__ ), specs["USL"]
		)
	);
	
	// Now convert the column to numeric	
	Column( dt, colNamesList[theCol] ) &amp;lt;&amp;lt; data type( character );
		
	// Now find all cells where values were eliminated
	dt &amp;lt;&amp;lt; select where( As Column( dt, colNamesList[theCol] ) == "" );
	
	// If non passing rows were found, process the column to change the passing rows to
	// a blank, and non passing to the name of the column
	If( N Rows( dt &amp;lt;&amp;lt; get selected rows ) &amp;gt; 0,
		// Now set all eliminated cells to have the value of the name of the column
		Column( dt, colNamesList[theCol] )[dt &amp;lt;&amp;lt; get selected rows] = Column( dt, colNamesList[theCol] ) &amp;lt;&amp;lt;
		get name;
		// Invert the row selection, to select all rows where values passed and set them to a blank
		dt &amp;lt;&amp;lt; invert row selection;
		Column( dt, colNamesList[theCol] )[dt &amp;lt;&amp;lt; get selected rows] = "";
	,	// else set all 
		Column( dt, colNamesList[theCol] )[Index( 1, N Rows( dt ) )] = ""
	);
);

// Now create a new column to hold the information on either that the row Passed or 
// which columns failed
dt &amp;lt;&amp;lt; New Column( "Pass_Fail", Character );

// Loop across all rows and set the values for the new column
For( theRow = 1, theRow &amp;lt;= N Rows( dt ), theRow++,
	If( Trim( Concat Items( dt[theRow, 0, ""] ) ) == "",
		:Pass_Fail[theRow] = "Pass"
	,
		thePass_Fail = Concat Items( dt[theRow, 0], "," );
		For( i = Length( thePass_Fail ), i &amp;gt;= 2, i--,
			If( Substr( thePass_Fail, i, 1 ) == ",",
				If( Substr( thePass_Fail, i - 1, 1 ) == ",",
					thePass_Fail = Substr( thePass_Fail, 1, i - 1 ) || Substr( thePass_Fail, i + 1 )
				)
			)
		);
		If( Right( thePass_Fail, 1) == ",", thePass_Fail = Left( thePass_Fail, length( thePass_Fail ) - 1 ) );
		:Pass_Fail[theRow] = thePass_Fail;
	)
);

// Only the new column is what is needed, so delete all other columns
dt &amp;lt;&amp;lt; delete columns( eval(colNamesList) );

// Add the new column to the original data table
dtOrig &amp;lt;&amp;lt; Update(
	With( dt )
);

// Delete the no longer needed work table
close(dt, nosave );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 08:07:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243196#M47995</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2020-01-28T08:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a pass_fail column</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243882#M48112</link>
      <description>&lt;P&gt;TXnelson writes really fabulous code!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, maybe a you are looking for a simple solution like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :Data &amp;gt;= 42,"Too High",If( :Data &amp;lt; 7,"Too Low","Just Right"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-01-30 at 10.55.37 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/21414iC058D4AD2404DEE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2020-01-30 at 10.55.37 AM.png" alt="Screen Shot 2020-01-30 at 10.55.37 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;this is just a nested If statement if the data values is 42 or higher the formula returns, "Too High", then if data is less than 7 it returns "Too Low", and if its neither too high or too low, then the formula returns "Just Right"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can paste the formula into the formula editor, and then substitute in the correct column name, values and messages. &amp;nbsp;(Right click on the column name, click on formula , and past the above JSL into the dialog)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;B&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 15:59:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243882#M48112</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2020-01-30T15:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a pass_fail column</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243913#M48118</link>
      <description>&lt;P&gt;I like simple, like me!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I simplified it (no nesting required):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :Data &amp;gt;= 42, "Too High", :Data &amp;lt; 7, "Too Low", "Just Right")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jan 2020 16:43:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243913#M48118</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-01-30T16:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a pass_fail column</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243919#M48122</link>
      <description>&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;I need to thank &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4386"&gt;@Byron_JMP&lt;/a&gt;&amp;nbsp;&amp;nbsp; for responding.&amp;nbsp; I had intended to respond to this discussion, and before I did, it moved on to an older page and thus it fell out of my memory.&amp;nbsp; Byron's response kicked the discussion back into my NameSpace.&amp;nbsp;&lt;BR /&gt;I believe all you have to do to fix your issue, is to validate that a given column has spec limits associated with it.&amp;nbsp; And, if no spec limits are found, then do not process that column.&amp;nbsp; Below is a somewhat cryptic suggested change that may do what you want.&amp;nbsp; The basics of the issue is to use an If() function to only process the code when the spec limits are found&amp;nbsp; This is a replacement for your current specs =&amp;nbsp; line of code&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;clear symbols(specs);
specs = Column( dt, colNamesList[theCol] ) &amp;lt;&amp;lt; get property( "spec limits" );
If(isEmpty(specs)==0,
	&amp;lt;all of the code to the end of the For loop
	);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 17:02:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/243919#M48122</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-01-30T17:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a pass_fail column</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/244344#M48145</link>
      <description>Thanks for your help!&lt;BR /&gt;This code work very well !!&lt;BR /&gt;Thanks :)&lt;/img&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Jan 2020 04:48:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-get-a-pass-fail-column/m-p/244344#M48145</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2020-01-31T04:48:29Z</dc:date>
    </item>
  </channel>
</rss>

