<?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 Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Im-trying-to-write-a-script-so-i-can-use-it-for-JMP-live-to/m-p/739229#M92073</link>
    <description>&lt;P&gt;My code to do this is below. Im not getting errors but its not working. I check the columns and they don't have the spec limits. The log is showing the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "MST";
"LSL:";
lsl = 9;
"USL:";
usl = 12.5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "FIBER";
"LSL:";
lsl = 7;
"USL:";
usl = 9;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "SULFUR";
"LSL:";
lsl = 1;
"USL:";
usl = 1.5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "FAT";
"LSL:";
lsl = 3;
"USL:";
usl = 5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "PROTEIN";
"LSL:";
lsl = 24;
"USL:";
usl = 27;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the JSL Script:&lt;/P&gt;&lt;P&gt;&amp;lt;JSL&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myDT = Open Database(
    "APP=JMP;DATABASE=BBAnalytics;DRIVER={SQL Server};Description=BB Analytics Data Warehouse;Trusted_Connection=Yes;UID=%_UID_%;WSID=SFX-JPCZ724;SERVER=SFX-DWA01;DBCNAME=SFX-DWA01;",
    "SELECT * FROM [dbo].[myDT]",
    "myDT"
);

specLimitsTable = Open Database(
    "APP=JMP;DATABASE=BBAnalytics;DRIVER={SQL Server};Description=BB Analytics Data Warehouse;Trusted_Connection=Yes;UID=%_UID_%;WSID=SFX-JPCZ724;SERVER=SFX-DWA01;DBCNAME=SFX-DWA01;",
    "SELECT * FROM [dbo].[specDTTest]",
    "specDTTest"
);

// Iterate over the rows of the spec limits table
// Iterate over the rows of the spec limits table
For Each Row(specLimitsTable,
    // Get values from the current row
    column_name = Column(specLimitsTable, "Column_Name")[Row()];
    lsl = Column(specLimitsTable, "LSL")[Row()];
    usl = Column(specLimitsTable, "USL")[Row()];

    // Set spec limits for the corresponding column in the main data table
    col_ref = Column(myDT, column_name);
    col_ref &amp;lt;&amp;lt; Set Property(
        "Spec Limits",
        {LSL(lsl), USL(usl), Show Limits(1)}
    );
	spec_limits = Column(myDT, column_name) &amp;lt;&amp;lt; Get Property("Spec Limits");
	Show(spec_limits);
	show(column_name &amp;lt;&amp;lt; Get Data Type());
	show(lsl &amp;lt;&amp;lt; Get Data Type());
    // Show the applied spec limits for each column
    Show(
        "Column:", column_name,
        "LSL:", lsl,
        "USL:", usl
    );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2024 21:02:11 GMT</pubDate>
    <dc:creator>bjbreitling</dc:creator>
    <dc:date>2024-03-26T21:02:11Z</dc:date>
    <item>
      <title>Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table.</title>
      <link>https://community.jmp.com/t5/Discussions/Im-trying-to-write-a-script-so-i-can-use-it-for-JMP-live-to/m-p/739229#M92073</link>
      <description>&lt;P&gt;My code to do this is below. Im not getting errors but its not working. I check the columns and they don't have the spec limits. The log is showing the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "MST";
"LSL:";
lsl = 9;
"USL:";
usl = 12.5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "FIBER";
"LSL:";
lsl = 7;
"USL:";
usl = 9;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "SULFUR";
"LSL:";
lsl = 1;
"USL:";
usl = 1.5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "FAT";
"LSL:";
lsl = 3;
"USL:";
usl = 5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name &amp;lt;&amp;lt; Get Data Type() = "Character";
:LSL &amp;lt;&amp;lt; Get Data Type() = "Numeric";
"Column:";
column_name = "PROTEIN";
"LSL:";
lsl = 24;
"USL:";
usl = 27;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the JSL Script:&lt;/P&gt;&lt;P&gt;&amp;lt;JSL&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myDT = Open Database(
    "APP=JMP;DATABASE=BBAnalytics;DRIVER={SQL Server};Description=BB Analytics Data Warehouse;Trusted_Connection=Yes;UID=%_UID_%;WSID=SFX-JPCZ724;SERVER=SFX-DWA01;DBCNAME=SFX-DWA01;",
    "SELECT * FROM [dbo].[myDT]",
    "myDT"
);

specLimitsTable = Open Database(
    "APP=JMP;DATABASE=BBAnalytics;DRIVER={SQL Server};Description=BB Analytics Data Warehouse;Trusted_Connection=Yes;UID=%_UID_%;WSID=SFX-JPCZ724;SERVER=SFX-DWA01;DBCNAME=SFX-DWA01;",
    "SELECT * FROM [dbo].[specDTTest]",
    "specDTTest"
);

// Iterate over the rows of the spec limits table
// Iterate over the rows of the spec limits table
For Each Row(specLimitsTable,
    // Get values from the current row
    column_name = Column(specLimitsTable, "Column_Name")[Row()];
    lsl = Column(specLimitsTable, "LSL")[Row()];
    usl = Column(specLimitsTable, "USL")[Row()];

    // Set spec limits for the corresponding column in the main data table
    col_ref = Column(myDT, column_name);
    col_ref &amp;lt;&amp;lt; Set Property(
        "Spec Limits",
        {LSL(lsl), USL(usl), Show Limits(1)}
    );
	spec_limits = Column(myDT, column_name) &amp;lt;&amp;lt; Get Property("Spec Limits");
	Show(spec_limits);
	show(column_name &amp;lt;&amp;lt; Get Data Type());
	show(lsl &amp;lt;&amp;lt; Get Data Type());
    // Show the applied spec limits for each column
    Show(
        "Column:", column_name,
        "LSL:", lsl,
        "USL:", usl
    );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 21:02:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Im-trying-to-write-a-script-so-i-can-use-it-for-JMP-live-to/m-p/739229#M92073</guid>
      <dc:creator>bjbreitling</dc:creator>
      <dc:date>2024-03-26T21:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table.</title>
      <link>https://community.jmp.com/t5/Discussions/Im-trying-to-write-a-script-so-i-can-use-it-for-JMP-live-to/m-p/739237#M92075</link>
      <description>&lt;P&gt;You are attempting to have JMP evaluate the contents of a JMP List.&amp;nbsp; Since a JMP List can contain just about anything, lists are not evaluated.&amp;nbsp; However, a wrapper can be placed around the code to evaluate the contents, and then be submitted to JMP for processing.&amp;nbsp; Try changing your Spec Limits code to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(
	Eval Expr(
		col_ref &amp;lt;&amp;lt; Set Property(
			"Spec Limits",
			{LSL( Expr( lsl ) ), USL( Expr( usl ) ),
			Show Limits( 1 )}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Mar 2024 21:14:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Im-trying-to-write-a-script-so-i-can-use-it-for-JMP-live-to/m-p/739237#M92075</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-03-26T21:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table.</title>
      <link>https://community.jmp.com/t5/Discussions/Im-trying-to-write-a-script-so-i-can-use-it-for-JMP-live-to/m-p/739313#M92099</link>
      <description>&lt;P&gt;Thanks! This did the trick!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 13:12:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Im-trying-to-write-a-script-so-i-can-use-it-for-JMP-live-to/m-p/739313#M92099</guid>
      <dc:creator>bjbreitling</dc:creator>
      <dc:date>2024-03-27T13:12:10Z</dc:date>
    </item>
  </channel>
</rss>

