<?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: JSL for importing spec limits in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783353#M96755</link>
    <description>&lt;P&gt;Are you sure your data in your spec limits table is numeric and not character?&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2024 06:35:05 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-08-22T06:35:05Z</dc:date>
    <item>
      <title>JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783073#M96703</link>
      <description>&lt;P&gt;I am writing a JSL code to import specification limits from a separate data table into the main data table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Open the Spec Limits table
specTable = Open("C:\Trending Tool Spec Limits.jmp");

// Open data table for analysis
dataTable = Data Table( "Trending data" );

// Extract Spec Limits and Show Limits from Spec Table
For Each Row(
    specName = specTable:Variable[];
    LSL = specTable:LSL[];
    USL = specTable:USL[];
    showLimits = specTable:Show Limits[]; // Assume Show Limits column has 1 for "show" and 0 for "hide"
    
    // Get the corresponding column in the data table
    col = Column( dataTable, specName );
    
    // Set the Spec Limits property as an associative array
    col &amp;lt;&amp;lt; Set Property( "Spec Limits", {LSL( LSL ), USL( USL ), "Show Limits"( showLimits )}         	
        );
    	
 );

// Close the Spec Limits table
Close( specTable, NoSave );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The script is setting up the spec. limit property in all the correct places given by the spec. limit table, but it is not importing the actual spec limits. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 10:43:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783073#M96703</guid>
      <dc:creator>Steffen_Bugge</dc:creator>
      <dc:date>2024-08-21T10:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783084#M96704</link>
      <description>&lt;P&gt;You can use Manage Limit platform for this if your data is in correct format&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dtLimits = New Table("Cities Limits",
	Add Rows(4),
	New Column("Process", Character, Set Values({"OZONE", "CO", "SO2", "NO"})),
	New Column("LSL", Numeric, Set Values([0, 0, 0, 0])),
	New Column("Target", Numeric, Set Values([0.2, 15, 0.05, 0.035])),
	New Column("USL", Numeric, Set Values([0.4, 30, 0.1, 0.07])),
	Set Label Columns(:Process)
);
dt = Open("$SAMPLE_DATA/Cities.jmp");
obj = dt &amp;lt;&amp;lt; Manage Limits(
	Process Variables(:OZONE, :CO, :SO2, :NO),
	Load From Limits Table(dtLimits)
);
obj &amp;lt;&amp;lt; Save to Column Properties;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you wish to go your route, you need to evaluate the limits&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(EvalExpr(
	col &amp;lt;&amp;lt; Set Property("Spec Limits", {LSL(Expr(LSL)), USL(Expr(USL)), Show Limits(Expr(showLimits)}))
));
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Aug 2024 10:53:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783084#M96704</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-21T10:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783145#M96715</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;, works like a charm!&lt;/P&gt;&lt;P&gt;I updated my original script to evaluate the limits.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Open the Spec Limits table
specTable = Open("C:\Trending Tool Spec Limits.jmp");

// Open data table for analysis
dataTable = Data Table( "Trending data" );

// Extract Spec Limits and Show Limits from Spec Table
For Each Row(
    specName = specTable:Variable[];
    LSL = specTable:LSL[];
    USL = specTable:USL[];
    showLimits = specTable:Show Limits[]; // Assume Show Limits column has 1 for "show" and 0 for "hide"
    
    // Get the corresponding column in the data table
    col = Column( dataTable, specName );
    
    // Set the Spec Limits property as an associative array
   Eval(EvalExpr(
	col &amp;lt;&amp;lt; Set Property("Spec Limits", {LSL(Expr(LSL)), USL(Expr(USL)), "Show Limits"n(Expr(showLimits)))})
	);
    	
 );

// Close the Spec Limits table
Close( specTable, NoSave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Aug 2024 06:49:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783145#M96715</guid>
      <dc:creator>Steffen_Bugge</dc:creator>
      <dc:date>2024-08-23T06:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783351#M96753</link>
      <description>&lt;P&gt;&lt;A href="#" target="_blank" rel="noopener"&gt;@jthi&lt;/A&gt;, when importing the spec limits with the EvalExpr function, the limits are imported but do not show up as limits before I open the spec. limit property window and press&amp;nbsp;Apply. Do you know why, and what can be done to avoid this?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 06:30:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783351#M96753</guid>
      <dc:creator>Steffen_Bugge</dc:creator>
      <dc:date>2024-08-22T06:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783353#M96755</link>
      <description>&lt;P&gt;Are you sure your data in your spec limits table is numeric and not character?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 06:35:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783353#M96755</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-22T06:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783507#M96788</link>
      <description>&lt;P&gt;Yes, it is numeric. It was saved from the Manage Limits platform.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 18:28:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783507#M96788</guid>
      <dc:creator>Steffen_Bugge</dc:creator>
      <dc:date>2024-08-22T18:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783510#M96790</link>
      <description>&lt;P&gt;Ah... now I did notice that you are using incorrect syntax for setting the limits, you are missing the list (squiggly brackets)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1724351816305.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/67433i4016F49C0849258E/image-size/large?v=v2&amp;amp;px=999" role="button" title="jthi_0-1724351816305.png" alt="jthi_0-1724351816305.png" /&gt;&lt;/span&gt;&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);

dtLimits = New Table("Cities Limits",
	Add Rows(4),
	New Column("Variable", Character, Set Values({"OZONE", "CO", "SO2", "NO"})),
	New Column("LSL", Numeric, Set Values([0, 0, 0, 0])),
	New Column("USL", Numeric, Set Values([0.4, 30, 0.1, 0.07])),
	New Column("Show Limits", Numeric, Set Values([1, 1, 1, 1]))
);
dt = Open("$SAMPLE_DATA/Cities.jmp");

For Each Row(dtLimits,
	specName = dtLimits:Variable[];
	low = dtLimits:LSL[];
	high = dtLimits:USL[];
	showLimits = dtLimits:Show Limits[];
	
	Eval(Eval Expr(
		Column(dt, specName) &amp;lt;&amp;lt; Set Property("Spec Limits", {LSL(Expr(low)), USL(Expr(high)), Show Limits(Expr(showLimits))})
	));
);

Close(dtLimits, NoSave);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Aug 2024 18:38:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783510#M96790</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-22T18:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: JSL for importing spec limits</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783595#M96807</link>
      <description>&lt;P&gt;Perfect, thanks! That did the trick!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 06:49:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-for-importing-spec-limits/m-p/783595#M96807</guid>
      <dc:creator>Steffen_Bugge</dc:creator>
      <dc:date>2024-08-23T06:49:11Z</dc:date>
    </item>
  </channel>
</rss>

