<?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: User Defined Function with Specified Column Name (JSL) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/User-Defined-Function-with-Specified-Column-Name-JSL/m-p/82889#M37345</link>
    <description>&lt;P&gt;Here is a script that will accomplish what you need.&amp;nbsp; It uses a pointer to the data table in the first example, and uses an actual table name in the second example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");


TestFunction = Function( {TableName, ColumnName, Value}, {},
TableName &amp;lt;&amp;lt; Select where(as column(ColumnName) == Value);
);

testfunction(dt,"age",13);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");


TestFunction = Function( {TableName, ColumnName, Value}, {},
data table(TableName) &amp;lt;&amp;lt; Select where(as column(ColumnName) == Value);
);

testfunction("Big Class","age",13);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Nov 2018 19:19:38 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-11-08T19:19:38Z</dc:date>
    <item>
      <title>User Defined Function with Specified Column Name (JSL)</title>
      <link>https://community.jmp.com/t5/Discussions/User-Defined-Function-with-Specified-Column-Name-JSL/m-p/82880#M37344</link>
      <description>&lt;P&gt;I am trying to create a user defined function where you can specify a column name as one of the inputs. For example, I would like to use the below code to create a function that selects rows where the specified "ColumnName" equals the input "Value":&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TestFunction = Function( {TableName, ColumnName, Value}, {},
TableName &amp;lt;&amp;lt; Select where(:ColumnName == Value);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, when I try and run this function, I get the following error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Name Unresolved: ColumnName{1} in access or evaluation of 'ColumnName' , :ColumnName/*###*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 18:59:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/User-Defined-Function-with-Specified-Column-Name-JSL/m-p/82880#M37344</guid>
      <dc:creator>twillkickers</dc:creator>
      <dc:date>2018-11-08T18:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Function with Specified Column Name (JSL)</title>
      <link>https://community.jmp.com/t5/Discussions/User-Defined-Function-with-Specified-Column-Name-JSL/m-p/82889#M37345</link>
      <description>&lt;P&gt;Here is a script that will accomplish what you need.&amp;nbsp; It uses a pointer to the data table in the first example, and uses an actual table name in the second example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");


TestFunction = Function( {TableName, ColumnName, Value}, {},
TableName &amp;lt;&amp;lt; Select where(as column(ColumnName) == Value);
);

testfunction(dt,"age",13);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");


TestFunction = Function( {TableName, ColumnName, Value}, {},
data table(TableName) &amp;lt;&amp;lt; Select where(as column(ColumnName) == Value);
);

testfunction("Big Class","age",13);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Nov 2018 19:19:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/User-Defined-Function-with-Specified-Column-Name-JSL/m-p/82889#M37345</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-11-08T19:19:38Z</dc:date>
    </item>
  </channel>
</rss>

