<?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 script error in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/867724#M103047</link>
    <description>&lt;P&gt;After a quick look through the JSL, I have observed 2 items that may cause issue.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;I am not aware of any function called Next().&amp;nbsp; You use it a couple of times in the code.&amp;nbsp; It is a guess that it may be the function Break() that you are looking to use.&lt;/LI&gt;
&lt;LI&gt;Around line 110 you are attempting to set the Spec Limits column property.&amp;nbsp; In it you reference the memory variables of usl and lsl.&amp;nbsp; The issue is that the references are within a JMP list {}.&amp;nbsp; JMP lists are not evaluated prior to execution.&amp;nbsp; Therefore, usl and lsl will not be evaluated. The easiest way to get the values evaluated is to use Eval( Evalexpr ())
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(
	Eval Expr(
		Column( dtData, dataColName ) &amp;lt;&amp;lt; Set Property(
			"Spec Limits",
			{LSL( Expr( lsl ) ), USL( Expr( usl ) ), Show Limits( 1 )}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
This will force the evaluation prior to actually executing the Set Property&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Fri, 11 Apr 2025 04:12:03 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2025-04-11T04:12:03Z</dc:date>
    <item>
      <title>jsl script error</title>
      <link>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/867659#M103042</link>
      <description>&lt;P&gt;Hi, I have 2 files(Limits and wat_combined). Limit file has the limits that i want to set to the same test in wat_combined file. My Jsl script is working as expected but the spec limit area of the column Please let me know how to fix that.&lt;BR /&gt;Jmp version: 18.2.0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;txnelson Note:&amp;nbsp; I edited&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/67420"&gt;@Pranadeep&lt;/a&gt;&amp;nbsp; initial message, moving the JSL into a JSL Box, and the log into a Code Box&lt;BR /&gt;my jsl code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// --- Configuration ---
limitsFilePath = "C:\\Users\\saipranadeep\\Desktop\\JMP_Data\\script check\\Limits.jmp";
dataFilePath = "C:\\Users\\saipranadeep\\Desktop\\JMP_Data\\script check\\wat_combined.jmp";

// --- Script ---
Print("--- Script Start ---");

Print("Attempting to close any existing tables...");
Try( Close( Data Table( "Limits" ), NoSave ) );
Try( Close( Data Table( "wat_combined" ), NoSave ) );
Print("Existing tables closed (if any).");

Print("Opening Limits file: " || limitsFilePath);
dtLimits = Open( limitsFilePath );
Print("Opening Data file: " || dataFilePath);
dtData = Open( dataFilePath );

Print("Checking if tables opened successfully...");
If( Is Empty( dtLimits ), Throw( "Failed to open Limits JMP file: " || limitsFilePath ) );
If( Is Empty( dtData ), Throw( "Failed to open wat_combined JMP file: " || dataFilePath ) );
Print("Limits table opened successfully: " || Char(!Is Empty( dtLimits )) || " (1=Yes, 0=No)");
Print("Data table opened successfully: " || Char(!Is Empty( dtData )) || " (1=Yes, 0=No)");

colName_Test = "Test"; // From Limits file
colName_USL = "USL"; // From Limits file
colName_LSL = "LSL"; // From Limits file
Print("Column names defined: Test='" || colName_Test || "', USL='" || colName_USL || "', LSL='" || colName_LSL || "'");

// --- Ensure 'Test' column is Character type ---
Column( dtLimits, colName_Test ) &amp;lt;&amp;lt; Set Data Type( Character );

// --- Create limit maps ---
lslMap = Associative Array();
uslMap = Associative Array();
rowCountLimits = N Row( dtLimits );
Print("Associative maps 'lslMap' and 'uslMap' created.");

// Populate limit maps with valid data from the Limits table
Print( "--- Start Populating Limit Maps (" || Char(rowCountLimits) || " rows total) ---" );
For( i = 1, i &amp;lt;= rowCountLimits, i++,
testNameKey_val = Column( dtLimits, colName_Test )[i];
usl_val = Column( dtLimits, colName_USL )[i];
lsl_val = Column( dtLimits, colName_LSL )[i];

If( Is Missing( usl_val ) | Is Missing( lsl_val ) | Is Missing( testNameKey_val ) | testNameKey_val == "",
Print( "Skipping Row " || Char(i) || " (Missing Data)" );
Next();
);

testNameKey = Char( testNameKey_val ); // Convert to string
lsl_num = Num( lsl_val );
usl_num = Num( usl_val );

If( Is Missing( lsl_num ) | Is Missing( usl_num ),
Print( "Skipping Row " || Char(i) || " (Invalid Numeric Conversion)" );
Next();
);

// Add to maps if valid
lslMap[testNameKey] = lsl_num;
uslMap[testNameKey] = usl_num;
Print( "Added LSL=" || Char(lsl_num) || ", USL=" || Char(usl_num) || " for test '" || testNameKey || "' to maps" );
);

Print( "--- Finished Populating Limit Maps ---" );

// --- Applying Spec Limits ---
Print("--- Applying Spec Limits to Columns ---");
dataCols = dtData &amp;lt;&amp;lt; Get Column Names( String );
limitTestNames = lslMap &amp;lt;&amp;lt; Get Keys;
appliedCount = 0;

For( i = 1, i &amp;lt;= N Items( dataCols ), i++,
dataColName = dataCols[i];
longestMatchName = ""; // Track the best matching test name
matchFound = 0; // Flag to check if any match is found

For( j = 1, j &amp;lt;= N Items( limitTestNames ), j++,
limitTestName = limitTestNames[j];
If( Contains( Lowercase( Trim( dataColName ) ), Lowercase( Trim( limitTestName ) ) ),
longestMatchName = limitTestName;
matchFound = 1;
);
);

If( matchFound,
lsl = lslMap[longestMatchName];
usl = uslMap[longestMatchName];

If( Is Number(lsl) &amp;amp; Is Number(usl),
// Apply Spec Limits and ensure Graph Reference Lines are shown
Column( dtData, dataColName ) &amp;lt;&amp;lt; Set Property(
"Spec Limits",
{LSL( lsl ), USL( usl ), Show Limits( 1 )}
);
appliedCount++;
Print( "Applied limits from [" || longestMatchName || "] to column: [" || dataColName || "] (LSL=" || Char( lsl ) || ", USL=" || Char( usl ) || ")" );
);
);
);

Print( "Applied limits to " || Char(appliedCount) || " columns." );

// --- Save Data Table ---
dtData &amp;lt;&amp;lt; Save( "$DESKTOP/JMP_Data/script check/wat_combined_with_limits.jmp" ); // Save table with changes

// --- Final Check ---
Print("Spec limits should now be applied to columns.");
Print("--- Script End ---");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Log:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;"--- Script Start ---"
"Attempting to close any existing tables..."
"Existing tables closed (if any)."
"Opening Limits file: C:\\Users\\saipranadeep\\Desktop\\JMP_Data\\script check\\Limits.jmp"
"Opening Data file: C:\\Users\\saipranadeep\\Desktop\\JMP_Data\\script check\\wat_combined.jmp"
"Checking if tables opened successfully..."
"Limits table opened successfully: 1 (1=Yes, 0=No)"
"Data table opened successfully: 1 (1=Yes, 0=No)"
"Column names defined: Test='Test', USL='USL', LSL='LSL'"
"Associative maps 'lslMap' and 'uslMap' created."
"--- Start Populating Limit Maps (4 rows total) ---"
"Added LSL=25, USL=83 for test 'Vtl_P3uL' to maps"
"Added LSL=30, USL=88 for test 'Vtl_P3S' to maps"
"Added LSL=30, USL=36 for test 'Vtl_P3L' to maps"
"Added LSL=26, USL=32 for test 'Vtl_P3eL' to maps"
"--- Finished Populating Limit Maps ---"
"--- Applying Spec Limits to Columns ---"
"Applied limits from [Vtl_P3uL] to column: [Vtl_P3uL] (LSL=25, USL=83)"
"Applied limits from [Vtl_P3S] to column: [Vtl_P3S] (LSL=30, USL=88)"
"Applied limits from [Vtl_P3L] to column: [Vtl_P3L] (LSL=30, USL=36)"
"Applied limits from [Vtl_P3eL] to column: [Vtl_P3eL] (LSL=26, USL=32)"
"Applied limits to 4 columns."
"Spec limits should now be applied to columns."
"--- Script End ---"&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Apr 2025 03:52:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/867659#M103042</guid>
      <dc:creator>Pranadeep</dc:creator>
      <dc:date>2025-04-11T03:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: jsl script error</title>
      <link>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/867670#M103043</link>
      <description>&lt;P&gt;issue:&lt;BR /&gt;&lt;SPAN&gt;Hi, I have 2 files(Limits and wat_combined). Limit file has the limits that i want to set to the same test in wat_combined(column) file. My Jsl script is working as expected but the spec limit area of the column is not being added. Please let me know how to fix that.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pranadeep_0-1744324498781.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/74749i4D5AED9270B1DDD1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pranadeep_0-1744324498781.png" alt="Pranadeep_0-1744324498781.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>Thu, 10 Apr 2025 22:35:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/867670#M103043</guid>
      <dc:creator>Pranadeep</dc:creator>
      <dc:date>2025-04-10T22:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: jsl script error</title>
      <link>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/867724#M103047</link>
      <description>&lt;P&gt;After a quick look through the JSL, I have observed 2 items that may cause issue.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;I am not aware of any function called Next().&amp;nbsp; You use it a couple of times in the code.&amp;nbsp; It is a guess that it may be the function Break() that you are looking to use.&lt;/LI&gt;
&lt;LI&gt;Around line 110 you are attempting to set the Spec Limits column property.&amp;nbsp; In it you reference the memory variables of usl and lsl.&amp;nbsp; The issue is that the references are within a JMP list {}.&amp;nbsp; JMP lists are not evaluated prior to execution.&amp;nbsp; Therefore, usl and lsl will not be evaluated. The easiest way to get the values evaluated is to use Eval( Evalexpr ())
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(
	Eval Expr(
		Column( dtData, dataColName ) &amp;lt;&amp;lt; Set Property(
			"Spec Limits",
			{LSL( Expr( lsl ) ), USL( Expr( usl ) ), Show Limits( 1 )}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
This will force the evaluation prior to actually executing the Set Property&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 11 Apr 2025 04:12:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/867724#M103047</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-04-11T04:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: jsl script error</title>
      <link>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/868298#M103124</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;If you're running into scripting issues or just prefer a ready-to-use solution, there's a short tutorial with a JMP add-in showing how to handle spec limits and yield analysis without writing JSL:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=Nx5jWKAl7Z0" target="_blank"&gt;https://www.youtube.com/watch?v=Nx5jWKAl7Z0&lt;/A&gt;&lt;BR /&gt;YieldOptiX is designed for test data workflows and it&amp;nbsp;leverages JMP’s manage spec limits feature by also adding the ability to automatically find the best limits based on distribution parameters — either within or beyond predefined constraints.&lt;BR /&gt;Might be helpful if you're looking for a more streamlined approach.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2025 09:21:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/jsl-script-error/m-p/868298#M103124</guid>
      <dc:creator>PercentileSeal4</dc:creator>
      <dc:date>2025-04-15T09:21:02Z</dc:date>
    </item>
  </channel>
</rss>

