<?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 Apply a formula from a list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56046#M31452</link>
    <description>&lt;P&gt;I would like to use list of formula and apply them to certain columns accordingly.&amp;nbsp; Currently throw an error:&lt;/P&gt;
&lt;P&gt;Send Expects Scriptable Object in access or evaluation of 'Send' , col &amp;lt;&amp;lt;&amp;nbsp; /*###*/Set Formula&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example formula list:&lt;/P&gt;
&lt;P&gt;{:Column 7 + 2, :Col1 + 8, :umn 2 * 3, 3, Empty(), Empty(), Empty(), Empty()}&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; ListSize + 1, i++,
	If( i &amp;gt; colSize,
		New Column( "temp" )
	);//create columns to accomidate list size
	col &amp;lt;&amp;lt; Set Formula( ms:formulaList[i] );//set column formulas
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 23:24:52 GMT</pubDate>
    <dc:creator>tdiehl</dc:creator>
    <dc:date>2023-06-09T23:24:52Z</dc:date>
    <item>
      <title>Apply a formula from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56046#M31452</link>
      <description>&lt;P&gt;I would like to use list of formula and apply them to certain columns accordingly.&amp;nbsp; Currently throw an error:&lt;/P&gt;
&lt;P&gt;Send Expects Scriptable Object in access or evaluation of 'Send' , col &amp;lt;&amp;lt;&amp;nbsp; /*###*/Set Formula&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example formula list:&lt;/P&gt;
&lt;P&gt;{:Column 7 + 2, :Col1 + 8, :umn 2 * 3, 3, Empty(), Empty(), Empty(), Empty()}&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; ListSize + 1, i++,
	If( i &amp;gt; colSize,
		New Column( "temp" )
	);//create columns to accomidate list size
	col &amp;lt;&amp;lt; Set Formula( ms:formulaList[i] );//set column formulas
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:24:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56046#M31452</guid>
      <dc:creator>tdiehl</dc:creator>
      <dc:date>2023-06-09T23:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a formula from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56059#M31456</link>
      <description>&lt;P&gt;Assuming that the list you showed in your question, is named "formulalist" and it is in the namespace called "ms" I believe the below script will do what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt; ListSize + 1, i++,
	If( i &amp;gt; colSize,
		New Column( "temp" )
	);//create columns to accomidate list size
	Eval(
		Substitute(
				Expr(
					:temp &amp;lt;&amp;lt; Set Formula( __formula__ );//set column formulas
				)
		),
		Expr( __formula__ ),
		Parse( Char( ms:formulaList[i] ) )
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Apr 2018 21:56:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56059#M31456</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-04-27T21:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a formula from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56070#M31466</link>
      <description>&lt;P&gt;Jim provided the Eval(Substitute()) syntax for working with expressions. However, your logic will only work if your list has place holders for current columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also if you create a new column called "temp" and then another it will be called "temp 1"; yet, you are only assigning formulas to column temp.&amp;nbsp; I attached an example script with logic that might work for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I often use Parse(Char()) when working with expressions, however, NameExpr() returns the value of the expression, unevaluated and is expecially useful when building expressions.&amp;nbsp; You should review the Parse and Name Expr() functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will see it in the attached script.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //Parse( Char( formulaList[i] ) )&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;NameExpr( formulalist[i] )&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, 28 Apr 2018 20:58:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56070#M31466</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-04-28T20:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a formula from a list</title>
      <link>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56152#M31516</link>
      <description>&lt;P&gt;Thanks, I had tried to use Parse() but looks like Char was the missing piece. I had used Parse for column names but had set those to string when getting names so it worked there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did forget to include the column reference in the code there as I had trimmed it down to focus on the issue.&amp;nbsp; I will definitely look in to how and why both those options work and why it was so difficult to find them.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 16:46:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Apply-a-formula-from-a-list/m-p/56152#M31516</guid>
      <dc:creator>tdiehl</dc:creator>
      <dc:date>2018-04-30T16:46:08Z</dc:date>
    </item>
  </channel>
</rss>

