<?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: Adding in spec limits script, error when moving to jmp 16 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474567#M71940</link>
    <description>&lt;P&gt;There were 2 issues.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The value for the variable "Version" had not been set.&lt;/LI&gt;
&lt;LI&gt;In JMP 16, the code stops when it comes across a Character variable.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I fixed both issues.&amp;nbsp; Rather than checking for a Data Type of Character, I actually check to make sure the Modeling Type is Continuous.&amp;nbsp; Nominal or Ordinal numeric columns also should not have Spec Limits set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
version = JMP Version();
/*** This script will save the values in the specified rows as ***/
/*** Spec Limit column attributes for each respective column.  ***/
/*** If there is no value for a particular column, the Spec    ***/
/*** Limit attribute for that column will not be changed. By   ***/
/*** saving the limits as column attributes, the Cpk analysis  ***/
/*** along with limits reference markers, will automatically   ***/
/*** be generated whenever a distribution is generated for a   ***/
/*** column.                                                   ***/
/*** Alternatively, this script can be used to delete the      ***/
/*** Spec Limits column attributes altogether by checking the  ***/
/*** "Delete Attributes" checkbox.                             ***/

// 10/28/2004 v2.0
// 12/24/2012 v2.1, modified to handle limits with units, like "2 Ohms"

Limits_dlg = Dialog(
	Text Box( Version ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( "Spec Limits:" ),
	Text Box( " " ),
	LineUp( 2,
		"LSL is in row", LSLRow = EditNumber( 1 ),
		"USL is in row", USLRow = EditNumber( 2 )
	),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( "My table already has Spec Limits attributes, and I want to delete them... " ),
	DelAttr = Check Box( "Delete Attributes", 0 ),
	Text Box( " " ),
	HList( Button( "OK" ), Button( "Cancel" ) )
);

If( Limits_dlg["Button"] == -1,
	Throw( "!User Cancelled" )
);

If( Limits_dlg["DelAttr"] == 1,
	For( i = 1, i &amp;lt; N Col() + 1, i++,
		Column( i ) &amp;lt;&amp;lt; Delete Property( "Spec Limits" )
	),  
   //Else...
	For( i = 1, i &amp;lt; N Col() + 1, i++,
		If( As Column( i ) &amp;lt;&amp;lt; get modeling type == "Continuous",
			LSpec = Column( i )[Limits_dlg["LSLRow"]];
			LSpec = Num( Word( 1, Char( LSpec ) ) ); //Truncate to numeric if it has units appended to it.
			USpec = Column( i )[Limits_dlg["USLRow"]];
			USpec = Num( Word( 1, Char( USpec ) ) ); //Truncate to numeric if it has units appended to it.
			Eval(
				Substitute(
						Expr(
							Column( i ) &amp;lt;&amp;lt; Set Property(
								"Spec Limits",
								{LSL( _LSL ), USL( _USL ), show limits( 1 )}
							)
						),
					Expr( _LSL ), LSpec,
					Expr( _USL ), USpec
				)
			);
		)
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Mar 2022 17:34:26 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-03-30T17:34:26Z</dc:date>
    <item>
      <title>Adding in spec limits script, error when moving to jmp 16</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474547#M71938</link>
      <description>&lt;P&gt;Hi Folks, new to jmp scripting.&amp;nbsp; I have a script attached that was written in 2012 and now does not function since moving to jmp16, it worked under jmp14.&amp;nbsp; It basically allows me to read in the upper and lower spec limits for all the column parameters. Below is the error message and a sample of my data file once I have read it in.&amp;nbsp; Any help would be greatly appreciated.&amp;nbsp; I did not write the script and the person has since left the company.&lt;/P&gt;&lt;P&gt;Thanks in advance for any assistance.&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="ppopp1618_0-1648660123282.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41314iDD35B4DE3FC86E11/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ppopp1618_0-1648660123282.png" alt="ppopp1618_0-1648660123282.png" /&gt;&lt;/span&gt;&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="ppopp1618_1-1648660196010.png" style="width: 855px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41315iA3E4E18E9971FB68/image-dimensions/855x124?v=v2" width="855" height="124" role="button" title="ppopp1618_1-1648660196010.png" alt="ppopp1618_1-1648660196010.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:14:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474547#M71938</guid>
      <dc:creator>ppopp1618</dc:creator>
      <dc:date>2023-06-09T18:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in spec limits script, error when moving to jmp 16</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474567#M71940</link>
      <description>&lt;P&gt;There were 2 issues.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The value for the variable "Version" had not been set.&lt;/LI&gt;
&lt;LI&gt;In JMP 16, the code stops when it comes across a Character variable.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I fixed both issues.&amp;nbsp; Rather than checking for a Data Type of Character, I actually check to make sure the Modeling Type is Continuous.&amp;nbsp; Nominal or Ordinal numeric columns also should not have Spec Limits set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
version = JMP Version();
/*** This script will save the values in the specified rows as ***/
/*** Spec Limit column attributes for each respective column.  ***/
/*** If there is no value for a particular column, the Spec    ***/
/*** Limit attribute for that column will not be changed. By   ***/
/*** saving the limits as column attributes, the Cpk analysis  ***/
/*** along with limits reference markers, will automatically   ***/
/*** be generated whenever a distribution is generated for a   ***/
/*** column.                                                   ***/
/*** Alternatively, this script can be used to delete the      ***/
/*** Spec Limits column attributes altogether by checking the  ***/
/*** "Delete Attributes" checkbox.                             ***/

// 10/28/2004 v2.0
// 12/24/2012 v2.1, modified to handle limits with units, like "2 Ohms"

Limits_dlg = Dialog(
	Text Box( Version ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( "Spec Limits:" ),
	Text Box( " " ),
	LineUp( 2,
		"LSL is in row", LSLRow = EditNumber( 1 ),
		"USL is in row", USLRow = EditNumber( 2 )
	),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( " " ),
	Text Box( "My table already has Spec Limits attributes, and I want to delete them... " ),
	DelAttr = Check Box( "Delete Attributes", 0 ),
	Text Box( " " ),
	HList( Button( "OK" ), Button( "Cancel" ) )
);

If( Limits_dlg["Button"] == -1,
	Throw( "!User Cancelled" )
);

If( Limits_dlg["DelAttr"] == 1,
	For( i = 1, i &amp;lt; N Col() + 1, i++,
		Column( i ) &amp;lt;&amp;lt; Delete Property( "Spec Limits" )
	),  
   //Else...
	For( i = 1, i &amp;lt; N Col() + 1, i++,
		If( As Column( i ) &amp;lt;&amp;lt; get modeling type == "Continuous",
			LSpec = Column( i )[Limits_dlg["LSLRow"]];
			LSpec = Num( Word( 1, Char( LSpec ) ) ); //Truncate to numeric if it has units appended to it.
			USpec = Column( i )[Limits_dlg["USLRow"]];
			USpec = Num( Word( 1, Char( USpec ) ) ); //Truncate to numeric if it has units appended to it.
			Eval(
				Substitute(
						Expr(
							Column( i ) &amp;lt;&amp;lt; Set Property(
								"Spec Limits",
								{LSL( _LSL ), USL( _USL ), show limits( 1 )}
							)
						),
					Expr( _LSL ), LSpec,
					Expr( _USL ), USpec
				)
			);
		)
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2022 17:34:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474567#M71940</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-03-30T17:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in spec limits script, error when moving to jmp 16</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474688#M71943</link>
      <description>&lt;P&gt;Thanks TX,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Still same error message.&amp;nbsp; You only added two lines I believe, no other changes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed I missed an original line in the org file.&lt;/P&gt;&lt;P&gt;Version = "Limits as Attributes, v2.1 December 24, 2012";&lt;/P&gt;&lt;P&gt;above was in the original file, not sure if that changes your proposed solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I watch the values for Version it certainly reads 16 witch is what I am running.&amp;nbsp; &amp;nbsp;It hangs up when I try to watch Names Default to Here?&lt;/P&gt;&lt;P&gt;Names Default To Here (1);&lt;BR /&gt;Version = JMP version ();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 20:09:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474688#M71943</guid>
      <dc:creator>ppopp1618</dc:creator>
      <dc:date>2022-03-30T20:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in spec limits script, error when moving to jmp 16</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474700#M71944</link>
      <description>&lt;P&gt;There is nothing to watch with Names Default to Here().&amp;nbsp; It is just setting a default scoping.&amp;nbsp; If your code is in the middle of a larger piece of code, the Names Default to Here() should be moved to the first line of the JSL, and if that does not work, then remove the line completely.&amp;nbsp; I also added a new If() clause, to not process the Spec Limits if the column is not a numeric continuous column.&lt;/P&gt;
&lt;P&gt;Remove the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Version = JMPVersion();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and use your&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Version = "Limits as Attributes, v2.1 December 24, 2012";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2022 20:52:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474700#M71944</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-03-30T20:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding in spec limits script, error when moving to jmp 16</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474702#M71945</link>
      <description>&lt;P&gt;Thank you kindly sir, that did the trick!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 21:27:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-in-spec-limits-script-error-when-moving-to-jmp-16/m-p/474702#M71945</guid>
      <dc:creator>ppopp1618</dc:creator>
      <dc:date>2022-03-30T21:27:37Z</dc:date>
    </item>
  </channel>
</rss>

