<?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 JMP script- Where( ) function not accepting string variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-script-Where-function-not-accepting-string-variable/m-p/433379#M68309</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I want to script the "By" in a call to the Pareto function.&amp;nbsp;I notice that Pareto plots plotted "By" something look like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Pareto Plot(Cause( :SBIN_NAM ), X( :Insertion ), Where( :lot_id == "4LU31HFN00_E95029" ))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The "Where" implements the "By" field from the Pareto function dialog box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I have a JMP script where I want to plot Pareto plots by a column called "lot_id".&amp;nbsp; However, I want the script to be general so I don't know what the "lot_id"s will be ahead of time.&amp;nbsp; So, what values get passed into "Where"- is determined at run-time by whatever lot_id's actually exist in the data table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first, I created a list of all the lot_id's called "listOfLotIDs" in the data table and tried the common-sense approach.&amp;nbsp; This did not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;For( i = 1, i &amp;lt;= N Items( listOfLotIDs ), i++,
	Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == listOfLotIDs[i] ));
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After some time I came to believe that my code didn't work because, for some reason lost to me, the value passed to the "Where" function must be defined within the parentheses with &lt;STRONG&gt;actual quotation marks&lt;/STRONG&gt;- you cannot just pass it a string variable.&amp;nbsp; So, I tried another variant:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;For( i = 1, i &amp;lt;= N Items( listOfLotIDs ), i++,
	sEval = "Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"" || listOfLotIDs[i] || "\!"))";
	eval(Parse(sEval));
	print("PRINT OUTPUT: " || sEval);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe the "parse" function compiles a JMP script and the "eval" function runs a piece of compiled JMP script? However, this ALSO does not work.&amp;nbsp; I included the print() of the string just to make sure I was assembling the string correctly.&amp;nbsp; This is what the log says:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFN00_E95029-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFN00_E95029\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFO00_E93847-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFO00_E93847\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFP00_E93981-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFP00_E93981\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFQ00_E95030-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFQ00_E95030\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFR00_E94699-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFR00_E94699\!"))"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So what in the world is wrong?&amp;nbsp; How did my escaped quotation marks (\!") get turned into dashes "-"?!&amp;nbsp; Please help.&lt;/P&gt;&lt;P&gt;By the way, the forum is claiming it removed "invalid HTML" from my message body, just beware, some of the code or error messages may be garbled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:40:02 GMT</pubDate>
    <dc:creator>tatarjj2</dc:creator>
    <dc:date>2023-06-10T23:40:02Z</dc:date>
    <item>
      <title>JMP script- Where( ) function not accepting string variable</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-Where-function-not-accepting-string-variable/m-p/433379#M68309</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I want to script the "By" in a call to the Pareto function.&amp;nbsp;I notice that Pareto plots plotted "By" something look like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Pareto Plot(Cause( :SBIN_NAM ), X( :Insertion ), Where( :lot_id == "4LU31HFN00_E95029" ))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The "Where" implements the "By" field from the Pareto function dialog box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I have a JMP script where I want to plot Pareto plots by a column called "lot_id".&amp;nbsp; However, I want the script to be general so I don't know what the "lot_id"s will be ahead of time.&amp;nbsp; So, what values get passed into "Where"- is determined at run-time by whatever lot_id's actually exist in the data table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first, I created a list of all the lot_id's called "listOfLotIDs" in the data table and tried the common-sense approach.&amp;nbsp; This did not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;For( i = 1, i &amp;lt;= N Items( listOfLotIDs ), i++,
	Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == listOfLotIDs[i] ));
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After some time I came to believe that my code didn't work because, for some reason lost to me, the value passed to the "Where" function must be defined within the parentheses with &lt;STRONG&gt;actual quotation marks&lt;/STRONG&gt;- you cannot just pass it a string variable.&amp;nbsp; So, I tried another variant:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;For( i = 1, i &amp;lt;= N Items( listOfLotIDs ), i++,
	sEval = "Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"" || listOfLotIDs[i] || "\!"))";
	eval(Parse(sEval));
	print("PRINT OUTPUT: " || sEval);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe the "parse" function compiles a JMP script and the "eval" function runs a piece of compiled JMP script? However, this ALSO does not work.&amp;nbsp; I included the print() of the string just to make sure I was assembling the string correctly.&amp;nbsp; This is what the log says:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFN00_E95029-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFN00_E95029\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFO00_E93847-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFO00_E93847\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFP00_E93981-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFP00_E93981\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFQ00_E95030-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFQ00_E95030\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFR00_E94699-)' : One or more columns have missing values on all rows. 

"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFR00_E94699\!"))"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So what in the world is wrong?&amp;nbsp; How did my escaped quotation marks (\!") get turned into dashes "-"?!&amp;nbsp; Please help.&lt;/P&gt;&lt;P&gt;By the way, the forum is claiming it removed "invalid HTML" from my message body, just beware, some of the code or error messages may be garbled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:40:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-Where-function-not-accepting-string-variable/m-p/433379#M68309</guid>
      <dc:creator>tatarjj2</dc:creator>
      <dc:date>2023-06-10T23:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: JMP script- Where( ) function not accepting string variable</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-Where-function-not-accepting-string-variable/m-p/433384#M68310</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Based on the Error Message, the issue may be related to the structure of the missing value in your data table and not with the Where statement. Would it be possible to share your data, or a mock version of your data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 00:23:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-Where-function-not-accepting-string-variable/m-p/433384#M68310</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-11-05T00:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: JMP script- Where( ) function not accepting string variable</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-Where-function-not-accepting-string-variable/m-p/433490#M68321</link>
      <description>&lt;P&gt;If I interpret "&lt;SPAN&gt;I want to script the "By" in a call to the Pareto function&lt;/SPAN&gt;" using JMP's own terminology, then please be aware that you can do things like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

dt = Open("$SAMPLE_DATA/Quality Control/Failures.jmp");
pp = dt &amp;lt;&amp;lt; Pareto Plot( Cause( :Causes ), Freq( :Count ), By(:Process));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this case you will get two plots in the same report window (because the table has data for two processes). But if it had data for ten processes, the same code would give ten plots.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 10:08:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-Where-function-not-accepting-string-variable/m-p/433490#M68321</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-11-05T10:08:10Z</dc:date>
    </item>
  </channel>
</rss>

