<?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: When a spec is on, how do I write a script when I want to write a fail name? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227864#M45205</link>
    <description>What are you doing in order to determine the fail name you want to write? That is necessary to know in order to help you write a script to do it. It looks like you want to label the row based on some finding across these 1000 Process columns.</description>
    <pubDate>Tue, 01 Oct 2019 22:08:15 GMT</pubDate>
    <dc:creator>MichelleG</dc:creator>
    <dc:date>2019-10-01T22:08:15Z</dc:date>
    <item>
      <title>When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227796#M45200</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image.jpg" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/19518i93E99C1FE69A8401/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image.jpg" alt="Image.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hi, I have one question.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="pack_group"&gt;&lt;DIV class="main_pack"&gt;&lt;DIV class="content_search section"&gt;&lt;DIV class="contents03"&gt;&lt;DIV class="contents03_sub"&gt;&lt;DIV class="cs_translator"&gt;&lt;DIV class="tlans_box"&gt;&lt;DIV class="txt_box rt _output on"&gt;&lt;DIV class="txt_area _view"&gt;&lt;P class="trans_txt _textview"&gt;When a spec is on, how do I write a script when I want to write a fail name?&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;like above image.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Please refer to the attachment(just samples).&lt;/P&gt;&lt;P&gt;In the actual data I write, there are 1000 columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 15:06:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227796#M45200</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2019-10-01T15:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227864#M45205</link>
      <description>What are you doing in order to determine the fail name you want to write? That is necessary to know in order to help you write a script to do it. It looks like you want to label the row based on some finding across these 1000 Process columns.</description>
      <pubDate>Tue, 01 Oct 2019 22:08:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227864#M45205</guid>
      <dc:creator>MichelleG</dc:creator>
      <dc:date>2019-10-01T22:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227868#M45207</link>
      <description>Attachment has 7 coulmns and i want to add one coulmn in order to check what columns spec out.&lt;BR /&gt;I just wanted to let you know that there are 1000 columns of data that I write in the company and i can't upload that because of confidential.&lt;BR /&gt;If you let me know how to do this on the attachment, i will edit it on my data.&lt;BR /&gt;Thanks!&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Oct 2019 00:02:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227868#M45207</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2019-10-02T00:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227869#M45208</link>
      <description>Okay, you want to add a column where it lists all the Process columns that spec out. That is, you want to check each column and append to a string for that row based on whether or not a condition is bad for that column's data. Right? If every column is within spec, what should it do? Is there a limit to how many column names you want listed, or do you want potentially all 7 (or 1000) listed if every single one is bad?&lt;BR /&gt;&lt;BR /&gt;How do you know which columns spec out? I'm just asking for the mathematical operation/s, not the exact numbers. I suspect there is a unique spec limit (or limits) for each column. For 7 columns, we could just define it in an array we loop over, but for 1000 columns you are probably going to want it in a reference table that you read in.</description>
      <pubDate>Wed, 02 Oct 2019 00:11:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227869#M45208</guid>
      <dc:creator>MichelleG</dc:creator>
      <dc:date>2019-10-02T00:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227881#M45211</link>
      <description>Yes! that' right.&lt;BR /&gt;If every colunm is within spec, i want to just write "PASS".&lt;BR /&gt;There is no limit. If every single one is bad, i want to write all listed.&lt;BR /&gt;I add LSL, USL spec using the Add-in program shown below.&lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/JMP-Add-Ins/Write-Limits-to-a-Data-Table-from-a-Limits-Table/ta-p/35790" target="_blank"&gt;https://community.jmp.com/t5/JMP-Add-Ins/Write-Limits-to-a-Data-Table-from-a-Limits-Table/ta-p/35790&lt;/A&gt;&lt;BR /&gt;Thanks a lot for your help :)&lt;/img&gt;</description>
      <pubDate>Wed, 02 Oct 2019 06:04:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227881#M45211</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2019-10-02T06:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227936#M45226</link>
      <description>&lt;P&gt;Okay, I'm not familiar with that add-in but perhaps its author&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;can speak to how to integrate information from that add-in here. I've written a little example that would do what you're looking for, tested against your 7-column example table, and I hope it is extensible to your 1000-column version. I'm assuming that we have a list of upper limits (UL) and a list of lower limits (LL) that are in the same order as the columns. You can read in a column from a data table, if needed, I just don't know where to access the data table from the add-in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are many different ways you could implement this. What I've written is just one way. The general plan I've used is: check each column against its respective limits. If it is out of spec, append to a list noting this. At the end of the loop, if the list is empty, write PASS. Otherwise, concatenate all the items in the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table(); // Process Measurements.jmp

// I just made these up.
// Assuming they are in the same order as the column names
ul = {10.5, 13.8, 2, 5, 1.1, 0.8, 11.8};
ll = {5.5, 13.4, 0.1, 1, 0.2, 0.2, 7};

col_list = dt &amp;lt;&amp;lt; get column names(String);
dt &amp;lt;&amp;lt; New Column("Check", Character, Nominal); // make blank column
// note that the new column is not in col_list

For Each Row( // in current data table
	failcheck = {}; // initialize empty list
	For(c=1, c&amp;lt;=N Items(col_list), c++, // loop over columns in col_list
		// check if lower than LL or higher than UL
		If(column(dt,col_list[c])[] &amp;lt; ll[c] | column(dt,col_list[c])[] &amp;gt; ul[c],
			// if so, add this column to the failcheck list
			Insert Into(failcheck, col_list[c])
		)
	);
	If(N Items(failcheck)==0, // is the list empty?
		column(dt,"Check")[] = "PASS",
		column(dt,"Check")[] = Concat Items(failcheck,", ")
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Does this make sense? Let me know if you have any questions about what is going on.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 17:22:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/227936#M45226</guid>
      <dc:creator>MichelleG</dc:creator>
      <dc:date>2019-10-02T17:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/228003#M45237</link>
      <description>&lt;P&gt;Here is my take on using the Spec Limits in each columns' Column Property to test each row.&amp;nbsp; The method used for the testing is to apply a Range Check to each column.&amp;nbsp; This is used because it is a very efficient way to deal with all of the data in a column with one operation.&amp;nbsp; Given the number of columns you are dealing with, this method should be more efficient than testing each cell.&amp;nbsp; In the script I use the Semiconductor Data Table from the Sample Data folder.&amp;nbsp; It has all spec limits set for all 128 measurement columns.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dtOrig = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

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;</description>
      <pubDate>Thu, 03 Oct 2019 09:14:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/228003#M45237</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-10-03T09:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/228255#M45286</link>
      <description>Wow, thank you, I have one more question.&lt;BR /&gt;If only the middle 100 of the 1,000 columns don't have specs, this script won't work. Can you solve it?&lt;BR /&gt;And I want the Pass fail column to be at the front.&lt;BR /&gt;Thanks a lot for your help!</description>
      <pubDate>Mon, 07 Oct 2019 05:50:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/228255#M45286</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2019-10-07T05:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/228256#M45287</link>
      <description>Thanks a lot MichelleG!!&lt;BR /&gt;This script was a great help to me.&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Oct 2019 05:52:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/228256#M45287</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2019-10-07T05:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: When a spec is on, how do I write a script when I want to write a fail name?</title>
      <link>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/229232#M45466</link>
      <description>*remind&lt;BR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&lt;BR /&gt;Wow, thank you, I have one more question.&lt;BR /&gt;If only the middle 100 of the 1,000 columns don't have specs or no value, this script won't work. Can you solve it?&lt;BR /&gt;And I want the Pass fail column to be at the front.&lt;BR /&gt;Thanks a lot for your help!</description>
      <pubDate>Mon, 14 Oct 2019 09:08:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/When-a-spec-is-on-how-do-I-write-a-script-when-I-want-to-write-a/m-p/229232#M45466</guid>
      <dc:creator>Song</dc:creator>
      <dc:date>2019-10-14T09:08:17Z</dc:date>
    </item>
  </channel>
</rss>

