<?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: &amp;quot;Get rows where&amp;quot; is taking way to long in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689200#M87506</link>
    <description>&lt;P&gt;Consider how JMP will be doing name-resolution.&amp;nbsp; When you run a &lt;CODE class=" language-jsl"&gt;Get Rows Where()&lt;/CODE&gt; function, it will go row-by-row over the table, evaluating the &lt;CODE class=" language-jsl"&gt;where&lt;/CODE&gt; expression.&amp;nbsp; Each evaluation will require name resolution for all variables defined, and since your &lt;CODE class=" language-jsl"&gt;vlist&lt;/CODE&gt; vairable is defined outside of the running loop, it will have to do some scope-walking each iteration, leading to a lot of wasted work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get around this, consider pre-evaluating any names that will be constant throughout the lookup, like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open(
	"J:\Public\Ti Process Control\Dashboard Files\JMP data for CC's\Limits\master_data_table_clean_up.jmp",
	invisible( 1 )
); //this is the reference table
dt &amp;lt;&amp;lt; begin data update;


cols = dt &amp;lt;&amp;lt; get column names();

dt2 = Data Table( "Master data pull daily download" );  //this is the main table
dt2 &amp;lt;&amp;lt; begin data update;
dt2 &amp;lt;&amp;lt; Clear Select();

cols2 = dt2 &amp;lt;&amp;lt; get column names();

vlist = {};
For( i = 1, i &amp;lt;= 2 /*N items(cols)*/, i++,
	Try( vlist = Column( dt, cols[i] ) &amp;lt;&amp;lt; get values );
	starttime = Tick Seconds();
	Eval( Eval Expr(
	Try( rowindex = dt2 &amp;lt;&amp;lt; Get Rows Where( Contains( Expr( vlist ), :WORKORDERNO ) ) );
	) );
	endtime = Tick Seconds();
	Print( "run time", Eval Insert( "Analysis took ^round(endtime - starttime)^ seconds" ) );
	Try( Column( dt2, cols[i] )[rowindex] = . );
);

dt2 &amp;lt;&amp;lt; end data update;

dt &amp;lt;&amp;lt; end data update;

Close( dt, nosave );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Notice&amp;nbsp; the &lt;CODE class=" language-jsl"&gt;Eval( Eval Expr( ... Expr( vlist ) ... ) )&lt;/CODE&gt; expression -- that is pre-evaluating &lt;CODE class=" language-jsl"&gt;vlist&lt;/CODE&gt; since it will be a constant throughout the loop.&lt;/P&gt;</description>
    <pubDate>Sun, 22 Oct 2023 06:43:15 GMT</pubDate>
    <dc:creator>ErraticAttack</dc:creator>
    <dc:date>2023-10-22T06:43:15Z</dc:date>
    <item>
      <title>"Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689187#M87505</link>
      <description>&lt;P&gt;I have a reference table where each column is a name from a main data table column and the values in the rows are the part numbers that have bad data for that column in the main table.&amp;nbsp; So for example, in the main table Column 1 is the part number and column 2 is "Temp".&amp;nbsp; Lets say that the row number equals part number so row 1 is part "1" and let say it has a value of 65 in the "Temp" column.&amp;nbsp; Part 2 has a temp of -100 and thus is bad data.&amp;nbsp; So in the reference table under the Column named "Temp" the value of row 1 is "2".&amp;nbsp; This is repeated for all the part numbers that have bad data in the main table and then is repeated for each column as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What this gives me is a bad data reference table I can then loop through to automatically remove the bad data each time I pull in the newest data for the main table.&amp;nbsp; I have the code that works however the line:&lt;/P&gt;&lt;P&gt;(where vlist contains all the part numbers from the reference table and dt2 is the main data table)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;try(rowindex=dt2 &amp;lt;&amp;lt; Get Rows Where(contains(vlist,:WORKORDERNO )));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is super slow.&amp;nbsp; It takes 22 seconds for it to complete.&amp;nbsp; As I have 196 columns to go through this takes way to long.&amp;nbsp; Any suggestions on how to speed this up would be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The full code is here:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt=open("J:\Public\Ti Process Control\Dashboard Files\JMP data for CC's\Limits\master_data_table_clean_up.jmp", invisible(1)); //this is the reference table
dt&amp;lt;&amp;lt;begin data update;


cols=dt&amp;lt;&amp;lt;get column names();

dt2=data table("Master data pull daily download");  //this is the main table
dt2&amp;lt;&amp;lt;begin data update;
dt2 &amp;lt;&amp;lt; Clear Select();

cols2=dt2&amp;lt;&amp;lt;get column names();

vlist={};
for(i=1,i&amp;lt;=2 /*N items(cols)*/,i++,
		try(vlist=column(dt,cols[i])&amp;lt;&amp;lt;get values;);
				starttime = tick seconds();
				try(rowindex=dt2 &amp;lt;&amp;lt; Get Rows Where(contains(vlist,:WORKORDERNO )));
				endtime= tick seconds();
				print( "run time",eval insert("Analysis took ^round(endtime - starttime)^ seconds"));
				try(column(dt2,cols[i]) [rowindex] = .);
);

dt2&amp;lt;&amp;lt;end data update;

dt&amp;lt;&amp;lt;end data update;

close(dt,nosave);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Oct 2023 04:40:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689187#M87505</guid>
      <dc:creator>shampton82</dc:creator>
      <dc:date>2023-10-22T04:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689200#M87506</link>
      <description>&lt;P&gt;Consider how JMP will be doing name-resolution.&amp;nbsp; When you run a &lt;CODE class=" language-jsl"&gt;Get Rows Where()&lt;/CODE&gt; function, it will go row-by-row over the table, evaluating the &lt;CODE class=" language-jsl"&gt;where&lt;/CODE&gt; expression.&amp;nbsp; Each evaluation will require name resolution for all variables defined, and since your &lt;CODE class=" language-jsl"&gt;vlist&lt;/CODE&gt; vairable is defined outside of the running loop, it will have to do some scope-walking each iteration, leading to a lot of wasted work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get around this, consider pre-evaluating any names that will be constant throughout the lookup, like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open(
	"J:\Public\Ti Process Control\Dashboard Files\JMP data for CC's\Limits\master_data_table_clean_up.jmp",
	invisible( 1 )
); //this is the reference table
dt &amp;lt;&amp;lt; begin data update;


cols = dt &amp;lt;&amp;lt; get column names();

dt2 = Data Table( "Master data pull daily download" );  //this is the main table
dt2 &amp;lt;&amp;lt; begin data update;
dt2 &amp;lt;&amp;lt; Clear Select();

cols2 = dt2 &amp;lt;&amp;lt; get column names();

vlist = {};
For( i = 1, i &amp;lt;= 2 /*N items(cols)*/, i++,
	Try( vlist = Column( dt, cols[i] ) &amp;lt;&amp;lt; get values );
	starttime = Tick Seconds();
	Eval( Eval Expr(
	Try( rowindex = dt2 &amp;lt;&amp;lt; Get Rows Where( Contains( Expr( vlist ), :WORKORDERNO ) ) );
	) );
	endtime = Tick Seconds();
	Print( "run time", Eval Insert( "Analysis took ^round(endtime - starttime)^ seconds" ) );
	Try( Column( dt2, cols[i] )[rowindex] = . );
);

dt2 &amp;lt;&amp;lt; end data update;

dt &amp;lt;&amp;lt; end data update;

Close( dt, nosave );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Notice&amp;nbsp; the &lt;CODE class=" language-jsl"&gt;Eval( Eval Expr( ... Expr( vlist ) ... ) )&lt;/CODE&gt; expression -- that is pre-evaluating &lt;CODE class=" language-jsl"&gt;vlist&lt;/CODE&gt; since it will be a constant throughout the loop.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 06:43:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689200#M87506</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2023-10-22T06:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689228#M87509</link>
      <description>&lt;P&gt;I believe you can use AsConstant(vList) to achieve the same effect, the name 'vlist' should only be evaluated once for each GetRowsWhere call.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 14:07:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689228#M87509</guid>
      <dc:creator>bculver</dc:creator>
      <dc:date>2023-10-22T14:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689229#M87510</link>
      <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26363"&gt;@ErraticAttack&lt;/a&gt;&amp;nbsp;, I popped your code modifications in and the code executed in 21 seconds vs 22 seconds.&amp;nbsp; So a little better but not where I need to be.&amp;nbsp; Any other ideas would be appreciated!&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 14:13:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689229#M87510</guid>
      <dc:creator>shampton82</dc:creator>
      <dc:date>2023-10-22T14:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689233#M87511</link>
      <description>&lt;P&gt;I also find using Loc to be faster in most situations like this, if you can find a way to use it. There may be a better way than this, but you can try something like this to replace the GetRowsWhere call.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "BadTable",
	Add Rows( 100 ),
	New Column( "BadPartNumbers",
		Formula( Random Integer( 1000 ) ),
	),
);
dt2 = New Table( "FullTable",
	Add Rows( 10000 ),
	New Column( "NewPartNumbers",
		Formula( Random Integer( 1000 ) ),
	),
);

newPNumbers = dt2:NewPartNumbers&amp;lt;&amp;lt; GetValues;
badPNumbers = AssociativeArray(dt:BadPartNumbers &amp;lt;&amp;lt; GetValues);

rowIndex = Loc(Matrix(badPNumbers &amp;lt;&amp;lt; GetValues(AsList(newPNumbers))));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm not exactly sure how your tables are set up, but basically it's turning the bad part numbers into an Associative array where bad part numbers return 1 and anything else returns 0. When you pass a list of all part numbers to GetValues, it returns a list of 1's and 0's for each row. Calling Loc on this returns the indices where 1 is found, which should correspond to the rows with bad part numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 14:42:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689233#M87511</guid>
      <dc:creator>bculver</dc:creator>
      <dc:date>2023-10-22T14:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689234#M87512</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26363"&gt;@ErraticAttack&lt;/a&gt;&amp;nbsp;So I made a test master data table and reference table to try and be able to share so people could play along but when I did that the script runs really fast, under a second.&amp;nbsp; So now I'm wondering if it has something to do with my actual data table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the test tables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shampton82_0-1697984891343.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57879iD57159F7140B67B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shampton82_0-1697984891343.png" alt="shampton82_0-1697984891343.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 14:42:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689234#M87512</guid>
      <dc:creator>shampton82</dc:creator>
      <dc:date>2023-10-22T14:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689235#M87513</link>
      <description>&lt;P&gt;Depending on your data there are many different methods you could use to perform these checks (joins/updates, loc, get rows where, associative array, summary table...). How many rows do your tables have? How many different values at max in your reference table columns? Are most of the values empty (remove empty values before performing comparison to make the list smaller or include it there just once)?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 17:01:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689235#M87513</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-22T17:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689244#M87514</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Here is an overview of the main table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shampton82_7-1697998161363.png" style="width: 224px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57887i00BEDD867B798D74/image-dimensions/224x727?v=v2" width="224" height="727" role="button" title="shampton82_7-1697998161363.png" alt="shampton82_7-1697998161363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and heres the ref table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shampton82_4-1697997765463.png" style="width: 225px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57884iD5334DDBE6F0E276/image-dimensions/225x190?v=v2" width="225" height="190" role="button" title="shampton82_4-1697997765463.png" alt="shampton82_4-1697997765463.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Heres how much data each column in the ref table has:(from the missing data screener output)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Number Missing&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;3115&lt;BR /&gt;6075&lt;BR /&gt;12237&lt;BR /&gt;16591&lt;BR /&gt;16591&lt;BR /&gt;16591&lt;BR /&gt;16591&lt;BR /&gt;16772&lt;BR /&gt;17038&lt;BR /&gt;17093&lt;BR /&gt;17095&lt;BR /&gt;17095&lt;BR /&gt;17099&lt;BR /&gt;17099&lt;BR /&gt;17109&lt;BR /&gt;17110&lt;BR /&gt;17113&lt;BR /&gt;21542&lt;BR /&gt;22781&lt;BR /&gt;23634&lt;BR /&gt;24792&lt;BR /&gt;24792&lt;BR /&gt;25058&lt;BR /&gt;25172&lt;BR /&gt;25280&lt;BR /&gt;25341&lt;BR /&gt;25356&lt;BR /&gt;25376&lt;BR /&gt;25376&lt;BR /&gt;25827&lt;BR /&gt;25863&lt;BR /&gt;25875&lt;BR /&gt;25893&lt;BR /&gt;25894&lt;BR /&gt;25897&lt;BR /&gt;25905&lt;BR /&gt;25942&lt;BR /&gt;25957&lt;BR /&gt;25963&lt;BR /&gt;25963&lt;BR /&gt;25963&lt;BR /&gt;25965&lt;BR /&gt;25968&lt;BR /&gt;25968&lt;BR /&gt;25968&lt;BR /&gt;25968&lt;BR /&gt;26367&lt;BR /&gt;26564&lt;BR /&gt;27190&lt;BR /&gt;27404&lt;BR /&gt;27414&lt;BR /&gt;27420&lt;BR /&gt;27437&lt;BR /&gt;27453&lt;BR /&gt;27465&lt;BR /&gt;27474&lt;BR /&gt;27478&lt;BR /&gt;27493&lt;BR /&gt;27503&lt;BR /&gt;27522&lt;BR /&gt;27547&lt;BR /&gt;27553&lt;BR /&gt;27573&lt;BR /&gt;27592&lt;BR /&gt;27597&lt;BR /&gt;27597&lt;BR /&gt;27597&lt;BR /&gt;27597&lt;BR /&gt;27619&lt;BR /&gt;27626&lt;BR /&gt;27628&lt;BR /&gt;27628&lt;BR /&gt;27629&lt;BR /&gt;27629&lt;BR /&gt;27629&lt;BR /&gt;27629&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So most the columns are full of "missing data"/blanks due to the few columns that have a ton of bad data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make me wonder if having all these blanks in the vlist is causing the slow down:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shampton82_6-1697998108875.png" style="width: 663px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57886i0DF97ABF3972DDD9/image-dimensions/663x106?v=v2" width="663" height="106" role="button" title="shampton82_6-1697998108875.png" alt="shampton82_6-1697998108875.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 18:12:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689244#M87514</guid>
      <dc:creator>shampton82</dc:creator>
      <dc:date>2023-10-22T18:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689245#M87515</link>
      <description>&lt;P&gt;Most likely it will cause a slowdown, especially if the value isn't found from the list&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

test = {"a", "b", "c", "d", "e", "f"};
test2 = test || Repeat({""}, 27629);
lookup_val = "a";
repeats = 200;

tests = {};
For(i = 1, i &amp;lt;= repeats, i++,
	start = HP Time();
	Contains(test, lookup_val);
	wait(0);
	end = HP Time();
	Insert Into(tests, (end-start)/1e6);	
);

tests2 = {};
For(i = 1, i &amp;lt;= repeats, i++,
	start = HP Time();
	Contains(test2, lookup_val);
	wait(0);
	end = HP Time();
	Insert Into(tests2, (end-start)/1e6);
);

Show(Mean(tests), Std Dev(tests), Mean(tests2), Std Dev(tests2));
Show(Median(tests2)/Median(tests));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;Both of these test scripts are fairly quickly written so there can be some mistakes&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

Random Reset(1);

dt_data = New Table("Data",
	Add Rows(30000),
	New Column("first", Numeric, Nominal, &amp;lt;&amp;lt; Set Each Value(Row())),
	New Column("second", Numeric, Nominal, &amp;lt;&amp;lt; Set Each Value(Row())),
	invisible
);
Column(dt_data, "first") &amp;lt;&amp;lt; Set Data Type("Character");
Column(dt_data, "second") &amp;lt;&amp;lt; Set Data Type("Character");


dt_lookup = New Table("Lookup",
	Add Rows(5000),
	New Column("first", Numeric, Nominal, Values(Random Shuffle(1::1000)[1::10])),
	New Column("second", Numeric, Nominal, Values(Random Shuffle(1::1000)[1::500])),
	invisible
);
Column(dt_lookup, "first") &amp;lt;&amp;lt; Set Data Type("Character");
Column(dt_lookup, "second") &amp;lt;&amp;lt; Set Data Type("Character");

start = HP Time();
dt_data &amp;lt;&amp;lt; Get Rows Where(Contains(As Constant(dt_lookup[0, "first"]), :first));
dt_data &amp;lt;&amp;lt; Get Rows Where(Contains(As Constant(dt_lookup[0, "second"]), :second));
end = HP Time();
show((end - start)/1e6);

wait(0);

start = HP Time();
dt_data &amp;lt;&amp;lt; Get Rows Where(Contains(As Constant(Associative Array(dt_lookup[0, "first"]) &amp;lt;&amp;lt; get keys), :first));
dt_data &amp;lt;&amp;lt; Get Rows Where(Contains(As Constant(Associative Array(dt_lookup[0, "second"]) &amp;lt;&amp;lt; get keys), :second));
end = HP Time();
show((end - start) / 1e6);

Close(dt_data, no save);
Close(dt_lookup, no save);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on how many values you have and if they are characters (I think in your case they are), using Summarize() instead of Associative Array() to get the unique values will be faster but this won't most likely have that big of an effect in this case&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt_lookup = New Table("Lookup",
	Add Rows(5000),
	New Column("test", Numeric, Nominal, Values(Random Shuffle(1::1000)[1::500])),
	invisible
);
Column(dt_lookup, "test") &amp;lt;&amp;lt; Set Data Type("Character");

start = HP Time();
Summarize(dt_lookup, uniq_vals = by(Column(dt_lookup, "test")));
end = HP Time();
show((end - start) / 1e6);

start = HP Time();
uniq_vals2 = Associative Array(Column(dt_lookup, "test")) &amp;lt;&amp;lt; get keys;
end = HP Time();
show((end - start) / 1e6);

Show(N Items(uniq_vals), N Items(uniq_vals2));
Close(dt_lookup, no save);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Oct 2023 19:00:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689245#M87515</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-22T19:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689246#M87516</link>
      <description>&lt;P&gt;I suspect all of the blanks will cause your code to slow down.&amp;nbsp; Here is a work around for that.&amp;nbsp; Just replace your creation of the vlist with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Try( vlist = Associative Array( As Column( cols[i] ) ) &amp;lt;&amp;lt; get keys );
If( vlist[1] == "",
	Remove From( vlist, 1, 1 )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Oct 2023 18:42:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689246#M87516</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-10-22T18:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689251#M87517</link>
      <description>&lt;P&gt;This worked great, thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;as well!&amp;nbsp; Didn't dig into his code he posted above as the copy and paste of txnelson code worked perfectly but I appreciate him taking the time to make it.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 22:01:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689251#M87517</guid>
      <dc:creator>shampton82</dc:creator>
      <dc:date>2023-10-22T22:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: "Get rows where" is taking way to long</title>
      <link>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689252#M87518</link>
      <description>&lt;P&gt;This goes most likely to category of premature optimization, but JMP's update can be sometimes very fast and it could most likely be used here with some column renaming and adding new column to your lookup table which is full of empty values&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt_data = New Table("Data",
	Add Rows(30000),
	New Column("first", Numeric, Nominal, &amp;lt;&amp;lt; Set Each Value(Row())),
	New Column("second", Numeric, Nominal, &amp;lt;&amp;lt; Set Each Value(Row())),
	invisible
);
Column(dt_data, "first") &amp;lt;&amp;lt; Set Data Type("Character");
Column(dt_data, "second") &amp;lt;&amp;lt; Set Data Type("Character");


dt_lookup = New Table("Lookup",
	Add Rows(5000),
	New Column("first", Numeric, Nominal, Values(Random Shuffle(1::30000)[1::500])),
	invisible
);
Column(dt_lookup, "first") &amp;lt;&amp;lt; Set Data Type("Character");

/*
start = HP Time();
Summarize(dt_lookup, uniq_vals = by(:first));
r = dt_data &amp;lt;&amp;lt; Get Rows Where(Contains(As Constant(uniq_vals), :first));
dt_data[r, "second"] = "";
end = HP Time();
Show((end-start)/1e6);
*/

missing_col = dt_lookup &amp;lt;&amp;lt; New Column("missing_vals", Numeric, Nominal);

start = HP Time();
i = 1;
Column(dt_lookup, "first") &amp;lt;&amp;lt; Set Name(Char(i));
missing_col &amp;lt;&amp;lt; Set Name("second");
dt_data &amp;lt;&amp;lt; Update(With(dt_lookup), Match Columns(:first = Eval(Char(i))), Replace Columns in Main Table(:second));
end = HP Time();
Show((end-start)/1e6);

Close(dt_data, no save);
Close(dt_lookup, no save);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Oct 2023 19:44:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/quot-Get-rows-where-quot-is-taking-way-to-long/m-p/689252#M87518</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-22T19:44:41Z</dc:date>
    </item>
  </channel>
</rss>

