<?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 JSL: Select Where with variable for column name in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Select-Where-with-variable-for-column-name/m-p/8276#M8270</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I'm trying to use select where to count the number of rows which meet criteria in 2 columns using a for loop. In the beginning of my script (not shown) I use a dialog to let the user choose 2 columns and this ends up in a list (collist). I then use an associative array on each to determine the unique values per column. A second dialog allows the user to choose a subset of those unique values per column which ends up in another list (poschosen). The problem I'm struggling with is inserting the columns from collist into the select where function. I've tried a bunch of different attempts at eval, expr, eval expr, parse, etc. to try to insert them appropriately but I just can't seem to find the correct way. I'm hoping someone has advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code adapted for the Sample Data: Children's Popularity. I'd like to replace the values (line 14) School and Goals to be collist[1] and collist[2] respectively. Thank you for your help in advance &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.jmp.com/5.0.2/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt; Elizabeth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13963881760985116" jivemacro_uid="_13963881760985116"&gt;&lt;BR /&gt;&lt;P&gt;dattable=Open( "$SAMPLE_DATA/Children's Popularity.jmp" );&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;poschosen={"Ridge","Sand","main","stop","Popular","Grades","stop"};&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;stoppos={4,7}; //determine the position of the separator "stop"&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Test1pos=subtract(stoppos[1],1); //determine the # of school column values chosen&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Test2posStart=add(stoppos[1],1); //determine where in the list the Goals column values start&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;collist={"School", "Goals"};&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;sumpositives=0;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;For (i = 1, i &amp;lt;= Test1pos, i++, //loop through the chosen school column values&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;For(f=Test2posStart, f&amp;lt;stoppos[2],f++, //loop through the chosen Goals column values&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;dattable&amp;lt;&amp;lt;select where(School==poschosen&lt;I&gt; &amp;amp; Goals==Poschosen&lt;F&gt;);&lt;/F&gt;&lt;/I&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;num_selected=nrows(dattable&amp;lt;&amp;lt;get selected rows); //count the rows selected&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;sumpositives=sumpositives+num_selected; //add the current selection count to previous count&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;print(sumpositives); //should be 56 in this example&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;); //end of inner for loop&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;); //end of outer for loop&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Apr 2014 21:37:33 GMT</pubDate>
    <dc:creator>elizperez</dc:creator>
    <dc:date>2014-04-01T21:37:33Z</dc:date>
    <item>
      <title>JSL: Select Where with variable for column name</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Select-Where-with-variable-for-column-name/m-p/8276#M8270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I'm trying to use select where to count the number of rows which meet criteria in 2 columns using a for loop. In the beginning of my script (not shown) I use a dialog to let the user choose 2 columns and this ends up in a list (collist). I then use an associative array on each to determine the unique values per column. A second dialog allows the user to choose a subset of those unique values per column which ends up in another list (poschosen). The problem I'm struggling with is inserting the columns from collist into the select where function. I've tried a bunch of different attempts at eval, expr, eval expr, parse, etc. to try to insert them appropriately but I just can't seem to find the correct way. I'm hoping someone has advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code adapted for the Sample Data: Children's Popularity. I'd like to replace the values (line 14) School and Goals to be collist[1] and collist[2] respectively. Thank you for your help in advance &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.jmp.com/5.0.2/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt; Elizabeth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13963881760985116" jivemacro_uid="_13963881760985116"&gt;&lt;BR /&gt;&lt;P&gt;dattable=Open( "$SAMPLE_DATA/Children's Popularity.jmp" );&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;poschosen={"Ridge","Sand","main","stop","Popular","Grades","stop"};&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;stoppos={4,7}; //determine the position of the separator "stop"&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Test1pos=subtract(stoppos[1],1); //determine the # of school column values chosen&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Test2posStart=add(stoppos[1],1); //determine where in the list the Goals column values start&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;collist={"School", "Goals"};&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;sumpositives=0;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;For (i = 1, i &amp;lt;= Test1pos, i++, //loop through the chosen school column values&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;For(f=Test2posStart, f&amp;lt;stoppos[2],f++, //loop through the chosen Goals column values&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;dattable&amp;lt;&amp;lt;select where(School==poschosen&lt;I&gt; &amp;amp; Goals==Poschosen&lt;F&gt;);&lt;/F&gt;&lt;/I&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;num_selected=nrows(dattable&amp;lt;&amp;lt;get selected rows); //count the rows selected&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;sumpositives=sumpositives+num_selected; //add the current selection count to previous count&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;print(sumpositives); //should be 56 in this example&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;); //end of inner for loop&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;); //end of outer for loop&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Apr 2014 21:37:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Select-Where-with-variable-for-column-name/m-p/8276#M8270</guid>
      <dc:creator>elizperez</dc:creator>
      <dc:date>2014-04-01T21:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: JSL: Select Where with variable for column name</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Select-Where-with-variable-for-column-name/m-p/8277#M8271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind I just figured it out &lt;SPAN __jive_emoticon_name="love" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.jmp.com/5.0.2/images/emoticons/love.gif"&gt;&lt;/SPAN&gt; (of course right after I post the question, doh)... line 14 works when I do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dattable&amp;lt;&amp;lt;select where(as column(dattable,collist[1])==poschosen&lt;I&gt; &amp;amp; as column(dattable,collist[2])==Poschosen&lt;F&gt;);&lt;/F&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Apr 2014 21:42:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Select-Where-with-variable-for-column-name/m-p/8277#M8271</guid>
      <dc:creator>elizperez</dc:creator>
      <dc:date>2014-04-01T21:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: JSL: Select Where with variable for column name</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Select-Where-with-variable-for-column-name/m-p/8278#M8272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been trying forever to figure this one out, finally found this thread. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Aug 2016 22:56:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Select-Where-with-variable-for-column-name/m-p/8278#M8272</guid>
      <dc:creator>kwtorek0</dc:creator>
      <dc:date>2016-08-29T22:56:54Z</dc:date>
    </item>
  </channel>
</rss>

