<?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 Adding explicit table reference in JSL code leads to unexpected results in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870682#M103421</link>
    <description>&lt;P&gt;I have a short JSL script that I'm looking to add to a larger automated workflow. The intent is to iterate over the values in a column (layer_type) and if it finds any value&amp;nbsp;&lt;EM&gt;other&amp;nbsp;&lt;/EM&gt;than SSOD the code should return 1. If all values in the columns are 'SSOD' then it should return 0. This is being used in a if/else split in a workflow to throw an error. In general if you have recommendations of a better way to code this up I'm all ears.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given the existing code - I've pulled it out of the workflow to debug. The code works as intended when I run it in a JSL window with the correct data table selected. However because I'm inserting it into a workflow for users I want to be explicit about the data table name as I've found that to be more robust, however when I add the first line of code it no longer works as intended - it still runs but always returns '1' regardless of the column values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The below JSL yields the expected results when run in a script window referencing the table (attached). Note the table as attached will return '0'. Modify a value in a single row in the 'layer_type' column to anything else and it should return 1.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stefan_Moser_0-1745881433448.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/75282iB8B677D24AFF7B58/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Stefan_Moser_0-1745881433448.png" alt="Stefan_Moser_0-1745881433448.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;Summarize( meas = by( :layer_type ) );
result = 0;

For( i = 1, i &amp;lt;= N Items( meas ), i++,
	If( meas[i] != "SSOD",
		result = 1;
		Break();
	)
);

result;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;However, when I modify only the beginning of the JSL to explicitly reference the table it no longer works - when I change a single value in the 'layer_type' column to anything other than SSOD it continues to return '0'. In fact I've tested this both ways by commenting out the &lt;CODE class=" language-jsl"&gt;Data Table( "layer_type_forum_help" ) &amp;lt;&amp;lt;&lt;/CODE&gt; code and it seems it always returns what was previously returned when the block started with the 'Summarize' command&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "layer_type_forum_help" ) &amp;lt;&amp;lt; Summarize( meas = by( :layer_type ) );
result = 0;

For( i = 1, i &amp;lt;= N Items( meas ), i++,
	If( meas[i] != "SSOD",
		result = 1;
		Break();
	)
);

result;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks you pre-emptively for your help!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Apr 2025 23:15:00 GMT</pubDate>
    <dc:creator>Stefan_Moser</dc:creator>
    <dc:date>2025-04-28T23:15:00Z</dc:date>
    <item>
      <title>Adding explicit table reference in JSL code leads to unexpected results</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870682#M103421</link>
      <description>&lt;P&gt;I have a short JSL script that I'm looking to add to a larger automated workflow. The intent is to iterate over the values in a column (layer_type) and if it finds any value&amp;nbsp;&lt;EM&gt;other&amp;nbsp;&lt;/EM&gt;than SSOD the code should return 1. If all values in the columns are 'SSOD' then it should return 0. This is being used in a if/else split in a workflow to throw an error. In general if you have recommendations of a better way to code this up I'm all ears.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given the existing code - I've pulled it out of the workflow to debug. The code works as intended when I run it in a JSL window with the correct data table selected. However because I'm inserting it into a workflow for users I want to be explicit about the data table name as I've found that to be more robust, however when I add the first line of code it no longer works as intended - it still runs but always returns '1' regardless of the column values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The below JSL yields the expected results when run in a script window referencing the table (attached). Note the table as attached will return '0'. Modify a value in a single row in the 'layer_type' column to anything else and it should return 1.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stefan_Moser_0-1745881433448.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/75282iB8B677D24AFF7B58/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Stefan_Moser_0-1745881433448.png" alt="Stefan_Moser_0-1745881433448.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;Summarize( meas = by( :layer_type ) );
result = 0;

For( i = 1, i &amp;lt;= N Items( meas ), i++,
	If( meas[i] != "SSOD",
		result = 1;
		Break();
	)
);

result;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;However, when I modify only the beginning of the JSL to explicitly reference the table it no longer works - when I change a single value in the 'layer_type' column to anything other than SSOD it continues to return '0'. In fact I've tested this both ways by commenting out the &lt;CODE class=" language-jsl"&gt;Data Table( "layer_type_forum_help" ) &amp;lt;&amp;lt;&lt;/CODE&gt; code and it seems it always returns what was previously returned when the block started with the 'Summarize' command&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "layer_type_forum_help" ) &amp;lt;&amp;lt; Summarize( meas = by( :layer_type ) );
result = 0;

For( i = 1, i &amp;lt;= N Items( meas ), i++,
	If( meas[i] != "SSOD",
		result = 1;
		Break();
	)
);

result;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks you pre-emptively for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 23:15:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870682#M103421</guid>
      <dc:creator>Stefan_Moser</dc:creator>
      <dc:date>2025-04-28T23:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding explicit table reference in JSL code leads to unexpected results</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870696#M103424</link>
      <description>&lt;P&gt;Your syntax for the Summary() function is incorrect.&amp;nbsp; See the Scripting Index for definition, syntax and examples&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Summarize(Data Table( "layer_type_forum_help" ),  meas = by( :layer_type ) );
result = 0;

For( i = 1, i &amp;lt;= N Items( meas ), i++,
	If( meas[i] != "SSOD",
		result = 1;
		Break();
	)
);

result;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Apr 2025 01:44:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870696#M103424</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-04-29T01:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Adding explicit table reference in JSL code leads to unexpected results</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870901#M103452</link>
      <description>&lt;P&gt;I think you can simply use the function call,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;N Items( meas )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To determine the answer. You are looking for a single value in this column. It should therefore result in a single group from the Summarize() function call. If the number of items is greater than one, you have at least one row with a different string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "layer_type_forum_help" ) &amp;lt;&amp;lt; Summarize( meas = By( :layer_type ) );
result = N Items( meas ) &amp;gt; 1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Apr 2025 14:39:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870901#M103452</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2025-04-29T14:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding explicit table reference in JSL code leads to unexpected results</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870958#M103456</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5358"&gt;@Mark_Bailey&lt;/a&gt;&amp;nbsp; I considered this but for the error check it is possible there could be one value that is not the desired one (SSOD) and I want to differentiate that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 15:52:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870958#M103456</guid>
      <dc:creator>Stefan_Moser</dc:creator>
      <dc:date>2025-04-29T15:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding explicit table reference in JSL code leads to unexpected results</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870965#M103457</link>
      <description>&lt;P&gt;*** Update: I apologize for my reply below. It might help someone, but it does not address your request. What do you want? Do you want to know if any value does not match and return after the first occurrence of a non-conforming value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You said, "&lt;SPAN&gt;I have a short JSL script that I'm looking to add to a larger automated workflow. The intent is to iterate over the values in a column (layer_type) and if it finds any value&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;other&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;than SSOD the code should return 1. If all values in the columns are 'SSOD' then it should return 0.&amp;nbsp;&lt;/SPAN&gt;"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Summarize( meas = By( :layer_type ) );
result = N Items( meas ) &amp;gt; 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This case exhibits only the value "SSOD" so it should return 0:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="same.png" style="width: 721px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/75312iEA71AAD3D4A853DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="same.png" alt="same.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The result is 0:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="same result.png" style="width: 802px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/75313iBB5151A9CF513A0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="same result.png" alt="same result.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Another case exhibits values other than "SSOD: so should return 1&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DIFF.png" style="width: 721px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/75314iB2F820F0F31396CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="DIFF.png" alt="DIFF.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The result is 1:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diff result.png" style="width: 802px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/75315i1C1D7F6096DF6A3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="diff result.png" alt="diff result.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 16:17:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/870965#M103457</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2025-04-29T16:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Adding explicit table reference in JSL code leads to unexpected results</title>
      <link>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/871148#M103479</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5358"&gt;@Mark_Bailey&lt;/a&gt;&amp;nbsp;- no worries it's tangentially related and I did ask about it in the post so appreciate your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can do a better job of explaining where that solution doesn't return the desired result. The examples in your most recent post are accurate and return the desired result. The third scenario is where the column contains all values that are&amp;nbsp;&lt;EM&gt;not&amp;nbsp;&lt;/EM&gt;SSOD. For example, the entire layer_type is filled with 'NAIL'. In that case I believe your code would return 0. The desired result would still be 1 (since not all values are SSOD).&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 16:30:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adding-explicit-table-reference-in-JSL-code-leads-to-unexpected/m-p/871148#M103479</guid>
      <dc:creator>Stefan_Moser</dc:creator>
      <dc:date>2025-04-30T16:30:23Z</dc:date>
    </item>
  </channel>
</rss>

