<?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: Change formula in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839506#M101463</link>
    <description>&lt;P&gt;&lt;SPAN&gt;The results of all Blacklist columns are NG.&amp;nbsp;In no order, as long as the value of the "Scan input" column appears in any row of the Blacklist column, NG will be displayed.&amp;nbsp;Using the formula makes it easy to find the defective product during the scanning process.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Feb 2025 06:39:11 GMT</pubDate>
    <dc:creator>Chris_Liu</dc:creator>
    <dc:date>2025-02-11T06:39:11Z</dc:date>
    <item>
      <title>Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839469#M101455</link>
      <description>&lt;P&gt;&amp;nbsp; &amp;nbsp;As the attachments show, the &lt;SPAN&gt;formula of&amp;nbsp;&lt;/SPAN&gt;column ROW(3) is&amp;nbsp;&lt;SPAN&gt;effective&amp;nbsp;but just&amp;nbsp;for one row.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;The &lt;SPAN&gt;formula of&amp;nbsp;&lt;/SPAN&gt;column "Used For loop " as below color shows,&amp;nbsp;&lt;SPAN&gt;I know that formulas can't contain For loops， so&amp;nbsp;remove the For loop parts and change "&lt;FONT color="#0000FF"&gt;:Scan input[i]"&amp;nbsp;&lt;FONT color="#000000"&gt;to&amp;nbsp;other expressions or&amp;nbsp;other&amp;nbsp;functions&amp;nbsp;to Implement from "&lt;FONT color="#0000FF"&gt;: Scan input[1]&lt;/FONT&gt;" to"&lt;FONT color="#0000FF"&gt;: Scan input[end row number]&lt;/FONT&gt;", then&amp;nbsp;automatically updated based on each row of the "Scan input" column. Please help to correct it, thanks！&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For(i = 1, i &amp;lt;= N Rows(), i++,
	If(Is Missing(:Scan input),
		"",
		If(Col Sum(:Blacklist == :Scan input[i]) &amp;gt; 0,
			"NG",
			"OK"
		)
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:07:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839469#M101455</guid>
      <dc:creator>Chris_Liu</dc:creator>
      <dc:date>2025-02-11T06:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839498#M101456</link>
      <description>&lt;P&gt;You stated that you can not have a For Loop in a formula.&amp;nbsp; The actual statement about For Loops in formulas is that there is not need to use a For Loop in a formula to loop through each row in a data table, because formulas are automatically applied to each row.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if there is a need for a For Loop to be run on each row, then it can certainly be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are 3 ways to write a formula that will do what I believe is your desired result&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1739250709205.png" style="width: 726px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/72790i5CA1DD65519D6766/image-dimensions/726x313?v=v2" width="726" height="313" role="button" title="txnelson_0-1739250709205.png" alt="txnelson_0-1739250709205.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;If( Is Missing( :Scan input ),
	theResult = "",
	theResult = "OK";
	For( i = 1, i &amp;lt;= N Rows( Current Data Table() ), i++,
		If( :Blacklist == :Scan input[i],
			theResult = "NG";
			Break();
		)
	);
);
theResult;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Missing( :Scan input ),
	"",
	curBlacklist = :Blacklist;
	If( N Rows( Current Data Table() &amp;lt;&amp;lt; get rows where( :Scan input == curBlacklist ) ) &amp;gt; 0,
		"NG",
		"OK"
	);
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant( Summarize( ScanList = by( :Scan input ) ) );
If( Is Missing( :Scan input ),
	"",
	If( N Rows( Loc( ScanList, :Blacklist ) ) &amp;gt; 0,
		"NG",
		"OK"
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Feb 2025 05:12:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839498#M101456</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-02-11T05:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839499#M101457</link>
      <description>&lt;P&gt;Thanks! &lt;SPAN&gt;However, the correct result on&amp;nbsp;rows 3 and 5 should show NG. It hasn't been solved yet.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:10:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839499#M101457</guid>
      <dc:creator>Chris_Liu</dc:creator>
      <dc:date>2025-02-11T06:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839500#M101458</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks!&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;However, the correct result on&amp;nbsp;rows 3 and 5 should show NG. It hasn't been solved yet.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:07:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839500#M101458</guid>
      <dc:creator>Chris_Liu</dc:creator>
      <dc:date>2025-02-11T06:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839501#M101459</link>
      <description>&lt;P&gt;How is "NG" or "OK" result to be determined (in words, not as a JSL)?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:14:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839501#M101459</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-02-11T06:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839502#M101460</link>
      <description>&lt;P&gt;The formulas that I provided all look at the value of Black List for a given row, and then look through all of the rows for Scan Input to see if there is any row that has the same value.&lt;/P&gt;
&lt;P&gt;I must have misinterpreted what you are trying to do.&amp;nbsp; I thought that was what your supplied JSL was trying to do.&amp;nbsp; Can you describe what your desired results are?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:19:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839502#M101460</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2025-02-11T06:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839503#M101461</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The results of all Blacklist columns are NG. The actual scenario is that the products produced by a fixture are already known to be NG. They need to be found out and scanned into the Scan input column with a barcode gun, and NG will be displayed as long as the value of the "Scan input" column is in any row of the Blacklist column. For example, row 1 is exactly equal so it shows NG, and row 3 is not exactly equal, but "X1" appears in row 1 of the Blacklist column, so need shows NG.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:32:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839503#M101461</guid>
      <dc:creator>Chris_Liu</dc:creator>
      <dc:date>2025-02-11T06:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839505#M101462</link>
      <description>&lt;P&gt;Collect all blacklist values to list/associative array and compare current rows value to that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant(
	bl = :Blacklist &amp;lt;&amp;lt; get values;
);
If(!IsMissing(:Scan input),
	If(Contains(bl, :Scan input),
		"NG"
	,
		"OK"
	);
,
	""
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1739255658084.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/72791i42E3FFE465368D12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1739255658084.png" alt="jthi_0-1739255658084.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:35:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839505#M101462</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-02-11T06:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Change formula</title>
      <link>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839506#M101463</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The results of all Blacklist columns are NG.&amp;nbsp;In no order, as long as the value of the "Scan input" column appears in any row of the Blacklist column, NG will be displayed.&amp;nbsp;Using the formula makes it easy to find the defective product during the scanning process.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2025 06:39:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-formula/m-p/839506#M101463</guid>
      <dc:creator>Chris_Liu</dc:creator>
      <dc:date>2025-02-11T06:39:11Z</dc:date>
    </item>
  </channel>
</rss>

