<?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 Lookup tables using JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284365#M54937</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote some code to implement a rudimentary lookup table for a voltage/time dataset. But because of the size of my dataset, it is freezing up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick background, there might be around 1000 rows (time intervals) for each run and there are around 1500 runs, so 1.5m rows in total. In a nutshell, I am doing the following in my code before I start using the lookup table:&lt;/P&gt;&lt;P&gt;- Process dataset&lt;/P&gt;&lt;P&gt;- Calculate dV/dt from data&lt;/P&gt;&lt;P&gt;- Use tabulate to find the peak dV/dt for each individual run and create a new data table called dt2.&lt;/P&gt;&lt;P&gt;- Create a new column in the dataset to write the peak dV/dt value next to each dV/dt value in each run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point my code starts going line by line through dt1, cross checking the different test parameters that define the # run against dt2 and finding the peak dV/dt and returning it to that line in dt1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code for searching the lookup table looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Current Data Table( dt1 );&lt;BR /&gt;&lt;BR /&gt;For Each Row(
	v = :sample;
	w = :temp;
	x = :cell;
	y = :vicl;
	z = :v_bg;&lt;BR /&gt;// Find the row in dt2 that matches v/w/x/y/z
	row = dt2 &amp;lt;&amp;lt; get rows where( :sample == v &amp;amp; :temp == w &amp;amp; :cell == x &amp;amp; :vicl == y &amp;amp; :v_bg == z);&lt;BR /&gt;// get values from the dV/dt peak column in dt2
	col = Column(dt2, "dvdt_abs_max") &amp;lt;&amp;lt; getValues;&lt;BR /&gt;// pick out the value of row[n] from that column and save into the active row in dt1
	:dVdt_peak = col[row]
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;This code worked when I tested it for a small set, but once I had my complete dataset, the infinite spinning wheel appeared. I'm pretty new to this and am sure there must be a better more efficient way to do this, I just haven't figured it out.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:17:23 GMT</pubDate>
    <dc:creator>mtrain</dc:creator>
    <dc:date>2023-06-10T23:17:23Z</dc:date>
    <item>
      <title>Lookup tables using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284365#M54937</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote some code to implement a rudimentary lookup table for a voltage/time dataset. But because of the size of my dataset, it is freezing up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick background, there might be around 1000 rows (time intervals) for each run and there are around 1500 runs, so 1.5m rows in total. In a nutshell, I am doing the following in my code before I start using the lookup table:&lt;/P&gt;&lt;P&gt;- Process dataset&lt;/P&gt;&lt;P&gt;- Calculate dV/dt from data&lt;/P&gt;&lt;P&gt;- Use tabulate to find the peak dV/dt for each individual run and create a new data table called dt2.&lt;/P&gt;&lt;P&gt;- Create a new column in the dataset to write the peak dV/dt value next to each dV/dt value in each run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point my code starts going line by line through dt1, cross checking the different test parameters that define the # run against dt2 and finding the peak dV/dt and returning it to that line in dt1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code for searching the lookup table looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Current Data Table( dt1 );&lt;BR /&gt;&lt;BR /&gt;For Each Row(
	v = :sample;
	w = :temp;
	x = :cell;
	y = :vicl;
	z = :v_bg;&lt;BR /&gt;// Find the row in dt2 that matches v/w/x/y/z
	row = dt2 &amp;lt;&amp;lt; get rows where( :sample == v &amp;amp; :temp == w &amp;amp; :cell == x &amp;amp; :vicl == y &amp;amp; :v_bg == z);&lt;BR /&gt;// get values from the dV/dt peak column in dt2
	col = Column(dt2, "dvdt_abs_max") &amp;lt;&amp;lt; getValues;&lt;BR /&gt;// pick out the value of row[n] from that column and save into the active row in dt1
	:dVdt_peak = col[row]
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;This code worked when I tested it for a small set, but once I had my complete dataset, the infinite spinning wheel appeared. I'm pretty new to this and am sure there must be a better more efficient way to do this, I just haven't figured it out.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:17:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284365#M54937</guid>
      <dc:creator>mtrain</dc:creator>
      <dc:date>2023-06-10T23:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup tables using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284367#M54938</link>
      <description>&lt;P&gt;Just quickly if it helps, the reason for this code is so that I can filter and delete rows based on whether they fall under some threshold that is a function of the peak dV/dt.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 05:46:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284367#M54938</guid>
      <dc:creator>mtrain</dc:creator>
      <dc:date>2020-08-06T05:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup tables using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284394#M54944</link>
      <description>&lt;P&gt;You are really making JMP do this the hard way.&amp;nbsp; The easiest and most efficient way to handle this is to use the Update Platform.&amp;nbsp; It should handle your lookup on 1.5m rows without an issue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Update(
	With( dt2 ),
	Match Columns( :sample == :sample, :temp == :temp, :cell == :cell, :vicl == :vicl, :v_bg == :v_bg ),
	Add Columns from Update Table( :dvdt_abs_max )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Aug 2020 10:15:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284394#M54944</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-08-06T10:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup tables using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284640#M54979</link>
      <description>&lt;P&gt;See&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;'s response, but also note that whilst 'For Each Row' is nice to write, my experience of it is that it executes very slowly.&amp;nbsp; A standard for-loop i.e. 'For (i=1,i&amp;lt;=nrows(dt),i++' is a much faster method for iterating over the rows of a table.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 22:33:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284640#M54979</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2020-08-06T22:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup tables using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284653#M54984</link>
      <description>&lt;P&gt;This function is exactly what I was looking for. Thank you &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 01:31:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284653#M54984</guid>
      <dc:creator>mtrain</dc:creator>
      <dc:date>2020-08-07T01:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup tables using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284654#M54985</link>
      <description>&lt;P&gt;Thanks for the pointer &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4536"&gt;@David_Burnham&lt;/a&gt;, I will remember that next time I find myself using 'For Each Row'.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 01:32:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Lookup-tables-using-JSL/m-p/284654#M54985</guid>
      <dc:creator>mtrain</dc:creator>
      <dc:date>2020-08-07T01:32:56Z</dc:date>
    </item>
  </channel>
</rss>

