<?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 Forming a Column Formula from an Associative Array in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Forming-a-Column-Formula-from-an-Associative-Array/m-p/900019#M106007</link>
    <description>&lt;P&gt;I looked but couldn't find a clear example.&amp;nbsp; I have a script that creates an associative array between pairs of columns in a table.&amp;nbsp; I now want to leverage that array to create a formula referencing both the value and the key.&amp;nbsp; How is this done?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( SpecCols ), i++,
    key = Column( dt, SpecCols[i] ); 
    value = Column( dt, Char(SpecCols[i])||" Pass/Fail");
    assocArray[key] = value;
			dt &amp;lt;&amp;lt; New Column( (Column( dt, SpecCols[i] ) &amp;lt;&amp;lt; get name) || " Best",
				Set Property( "Notes", Notes ),
				Set Property( "Limits", Limits ),
				Formula(If(
	:RETEST == Col Minimum(
		If(
			Col Mean( value, :LOT, :WAFER, :RETEST ) ==
			Eval( Parse( value)),
			:RETEST
		),
		:LOT,
		:WAFER,
		:SiteY,
		:SiteX
	),
	Eval( Parse(key))
))
);
);&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Sep 2025 14:11:01 GMT</pubDate>
    <dc:creator>SpannerHead</dc:creator>
    <dc:date>2025-09-12T14:11:01Z</dc:date>
    <item>
      <title>Forming a Column Formula from an Associative Array</title>
      <link>https://community.jmp.com/t5/Discussions/Forming-a-Column-Formula-from-an-Associative-Array/m-p/900019#M106007</link>
      <description>&lt;P&gt;I looked but couldn't find a clear example.&amp;nbsp; I have a script that creates an associative array between pairs of columns in a table.&amp;nbsp; I now want to leverage that array to create a formula referencing both the value and the key.&amp;nbsp; How is this done?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= N Items( SpecCols ), i++,
    key = Column( dt, SpecCols[i] ); 
    value = Column( dt, Char(SpecCols[i])||" Pass/Fail");
    assocArray[key] = value;
			dt &amp;lt;&amp;lt; New Column( (Column( dt, SpecCols[i] ) &amp;lt;&amp;lt; get name) || " Best",
				Set Property( "Notes", Notes ),
				Set Property( "Limits", Limits ),
				Formula(If(
	:RETEST == Col Minimum(
		If(
			Col Mean( value, :LOT, :WAFER, :RETEST ) ==
			Eval( Parse( value)),
			:RETEST
		),
		:LOT,
		:WAFER,
		:SiteY,
		:SiteX
	),
	Eval( Parse(key))
))
);
);&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2025 14:11:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Forming-a-Column-Formula-from-an-Associative-Array/m-p/900019#M106007</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-09-12T14:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Forming a Column Formula from an Associative Array</title>
      <link>https://community.jmp.com/t5/Discussions/Forming-a-Column-Formula-from-an-Associative-Array/m-p/900150#M106014</link>
      <description>&lt;P&gt;Expression evaluation and in cases like this I like using Eval(Substitute())&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

aa = Associative Array();
aa["NPN1"] = "NPN2";
aa["PNP1"] = "PNP2";
aa["INM1"] = "INM2";

new_cols = {};
For Each({{key, val}}, aa,
	new_col = Eval(Substitute(
		Expr(dt &amp;lt;&amp;lt; New Column(key ||" "|| val, Numeric, Continuous, Formula(
			_term1_ + _term2_
		))),
		Expr(_term1_), Name Expr(AsColumn(dt, key)),
		Expr(_term2_), Name Expr(AsColumn(dt, val))
	));
	Insert Into(new_cols, (new_col &amp;lt;&amp;lt; get name))
);

dt &amp;lt;&amp;lt; Move Selected Columns(new_cols, To First);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 13 Sep 2025 06:04:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Forming-a-Column-Formula-from-an-Associative-Array/m-p/900150#M106014</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-09-13T06:04:09Z</dc:date>
    </item>
  </channel>
</rss>

