<?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: Iterating Down Rows in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39411#M23047</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;It sounds like you have a column name and JSL variable name that are the same. &amp;nbsp;See the &lt;A href="http://www.jmp.com/support/help/13-1/Scoping_Operators.shtml#515837" target="_self"&gt;Preventing Column Name and Variable Name Conflicts&lt;/A&gt; section in the online documentation.&lt;/P&gt;
&lt;P&gt;Hope this is helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2017 16:23:57 GMT</pubDate>
    <dc:creator>Wendy_Murphrey</dc:creator>
    <dc:date>2017-05-19T16:23:57Z</dc:date>
    <item>
      <title>Iterating Down Rows</title>
      <link>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39407#M23045</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to JMP/JSL but have experience with Java and am currently writing a program that needs to iterate through a column of address data and check if the address is already in the system; if it is, it should populate new columns with the latitude and longitude values. I'm using associative arrays and this is what I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NamesDefaultToHere(1); //all variables local&lt;BR /&gt;rawData = Open("Kevin-PriceAnalysis-DO Basis US thru April.jmp");&lt;BR /&gt;Current Data Table(rawData); //current data table set to list of hospitals&lt;BR /&gt;address = Column(rawData, "Full Address");&lt;BR /&gt;dt_latMap = Associative Array(address, rawData:Latitude); //maps unique full address to latitude&lt;BR /&gt;dt_longMap = Associative Array(address, rawData:Longitude); //maps unique full address to longitude&lt;BR /&gt;dt_coord = new Table("Coordinates",&lt;BR /&gt;New Column("Lat", Numeric, Continuous, Format("Lat DDD", 24, 14)),&lt;BR /&gt;New Column("Long", Numeric, Continuous, Format("Long DDD", 24, 14))&lt;BR /&gt;); //new data table of coordinates (empty)&lt;BR /&gt;For(i = 1, i &amp;lt;= N Rows(rawData), i++, //iterates through raw data, checks if contaied in map&lt;BR /&gt;If(Contains(dt_latMap, address[i]), //if yes updates coordinates&lt;BR /&gt;dt_coord:Lat = dt_latMap&amp;lt;&amp;lt;Get Value(address[i]);&lt;BR /&gt;dt_coord:Long = dt_longMap&amp;lt;&amp;lt;Get Value(address[i]),&lt;BR /&gt;!Contains(dt_latMap, address[i]), //if not, keep looping&lt;BR /&gt;continue();&lt;BR /&gt;);&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I keep getting an "cannot set value for 'Lat' because row number (-1) is invalid. I thought it could be a problem with column naming but I tried changing the names of the columns. Any help would be greatly appreciated! Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 15:45:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39407#M23045</guid>
      <dc:creator>nqj</dc:creator>
      <dc:date>2017-05-19T15:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Iterating Down Rows</title>
      <link>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39411#M23047</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;It sounds like you have a column name and JSL variable name that are the same. &amp;nbsp;See the &lt;A href="http://www.jmp.com/support/help/13-1/Scoping_Operators.shtml#515837" target="_self"&gt;Preventing Column Name and Variable Name Conflicts&lt;/A&gt; section in the online documentation.&lt;/P&gt;
&lt;P&gt;Hope this is helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 16:23:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39411#M23047</guid>
      <dc:creator>Wendy_Murphrey</dc:creator>
      <dc:date>2017-05-19T16:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Iterating Down Rows</title>
      <link>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39412#M23048</link>
      <description>&lt;P&gt;Hi Wendy,&lt;/P&gt;&lt;P&gt;I've tried changing all column and variable names and am still having the same issue. I have since changed the code that populates the associative array as such:&lt;/P&gt;&lt;P&gt;For(j = 1, j&amp;lt;= N Rows(rawData),j++,&lt;BR /&gt;If(!Contains(dt_latMap, address[j]),&lt;BR /&gt;dt_latMap &amp;lt;&amp;lt; Insert(address[j], rawData:Latitude[j]),&lt;BR /&gt;!Contains(dt_LongMap,address[j]),&lt;BR /&gt;dt_longMap &amp;lt;&amp;lt; Insert(address[j], rawData:Longitude[j]);&lt;BR /&gt;)&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I am still getting the invalid row number, this time saying that the index is 0. Am I forgetting to set the current row somewhere? Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 16:29:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39412#M23048</guid>
      <dc:creator>nqj</dc:creator>
      <dc:date>2017-05-19T16:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Iterating Down Rows</title>
      <link>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39427#M23055</link>
      <description>&lt;P&gt;I just stepped through your code using the San Francisco Crime.jmp table. &amp;nbsp;Sorry I didn't notice this before, but the dt_coord table has no rows. &amp;nbsp;When the criteria is met in your If(), first add a row. &amp;nbsp;Then use that row number as a subscript to your column reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;		Contains( dt_latMap, address[i] ), //if yes updates coordinates
			dt_coord &amp;lt;&amp;lt; Add Rows( 1 );
			r = N Rows( dt_coord );
			dt_coord:Lat[r] = dt_latMap &amp;lt;&amp;lt; Get Value( address[i] );
			dt_coord:Long[r] = dt_longMap &amp;lt;&amp;lt; Get Value( address[i] );,
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2017 20:12:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39427#M23055</guid>
      <dc:creator>Wendy_Murphrey</dc:creator>
      <dc:date>2017-05-19T20:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Iterating Down Rows</title>
      <link>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39486#M23095</link>
      <description>&lt;P&gt;thanks so much!&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2017 11:45:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Iterating-Down-Rows/m-p/39486#M23095</guid>
      <dc:creator>nqj</dc:creator>
      <dc:date>2017-05-22T11:45:08Z</dc:date>
    </item>
  </channel>
</rss>

