<?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: Matching ID_HEX List to Global Reference Table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/886092#M104838</link>
    <description>&lt;P&gt;using an associative array, you should see &amp;lt;2 minutes&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtSensor = Open( "$DESKTOP/TPMS_Sensor_install_DATA.jmp" );
hexList = Column( dtSensor, "ID_HEX" ) &amp;lt;&amp;lt; Get Values; //1048575 
lookup = Associative Array( hexList );//231356
hexList = lookup &amp;lt;&amp;lt; getkeys; // the keep list.
// manufacture a 12 million row table with 50% matches
n = 12e6; // about 1/4 minute to build a test table...
dtGlobal = New Table( "Untitled",
	Add Rows( n ),
	New Column( "ID_HEX",
		Character,
		"Nominal",
		Set Values( Transform Each( {v}, Repeat( {"1", "0"}, n / 2 ), If( v == "1", "badc0de", hexlist[Random Integer( 1, N Items( hexlist ) )] ) ) )
	),
	New Column( "Ref Produit", setvalues( 1 :: n ) ), // even rows match the keep list
	New Column( "ProductName", setvalues( 1 :: n ) ) // odd rows are badc0de, not in keep list
);


unwantedrows = dtGlobal &amp;lt;&amp;lt; get rows where( !(lookup &amp;lt;&amp;lt; Contains( ID_HEX )) ); // about a minute to identify the rows

dtGlobal &amp;lt;&amp;lt; deleterows( unwantedrows );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jul 2025 19:56:05 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2025-07-09T19:56:05Z</dc:date>
    <item>
      <title>Matching ID_HEX List to Global Reference Table</title>
      <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885332#M104828</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I’m working in JMP with two tables:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;TPMS_Sensor_install_DATA.jmp :&amp;nbsp; contains a single key column ID_HEX.&lt;/LI&gt;
&lt;LI&gt;TableID Globale.jmp contains the key column ID along with all the descriptive columns (Ref Produit, ProductName, Date, Operator, etc.).&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Goal: Filter the global table so that it only keeps rows whose ID appears in my ID_HEX list, and then return only the Ref Produit and ProductName columns.&lt;/P&gt;
&lt;P&gt;Here’s the script I’ve tried—it ends up returning the entire global table unfiltered:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// 1. Open both tables invisibly
dtSensor = Open( "D:\\Project JMP\\IDEnorme\\TPMS_Sensor_install_DATA.jmp", Invisible );
dtGlobal = Open( "D:\\Project JMP\\Tables Données\\TableID Globale.jmp", Invisible );

// 2. Extract the list of ID_HEX values from dtSensor
hexList = Column( dtSensor, "ID_HEX" ) &amp;lt;&amp;lt; Get Values;

// 3. Subset dtGlobal: keep only rows where :ID is in hexList,
//    and select only Ref Produit + ProductName
dtResult = dtGlobal &amp;lt;&amp;lt; Subset(
    Where( Contains( hexList, :ID ) ),
    Select(
        :"Ref Produit",
        :"ProductName"
    ),
    Output Table Name( "Résultats Correspondance" )
);

// 4. Show the result
dtResult &amp;lt;&amp;lt; Show Window;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can someone help me correct this script so that it: actually filters TableID Globale by the hexList of ID_HEX values, and returns only the Ref Produit and ProductName columns with the ID matched.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Any pointers or example JSL snippets would be greatly appreciated!&lt;/P&gt;
&lt;P&gt;Thanks in advance !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jul 2025 14:44:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885332#M104828</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2025-07-09T14:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Matching ID_HEX List to Global Reference Table</title>
      <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885439#M104830</link>
      <description>&lt;P&gt;Have you tried if join would be enough for you? Other option would be to use &amp;lt;&amp;lt; Get Rows Where to get the rows of interest and subset based on that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rows_of_interest = dtGlobal &amp;lt;&amp;lt; Get Rows Where(Contains(hexList, :ID));
dt_new = dtGlobal &amp;lt;&amp;lt; Subset(Rows(rows_of_interest), Columns(:Ref Produit, :ProductName), Output table("Filtered"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or something similar&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jul 2025 14:52:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885439#M104830</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-09T14:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Matching ID_HEX List to Global Reference Table</title>
      <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885606#M104833</link>
      <description>&lt;P&gt;I’ve tried it, but the script takes an extremely long time and produces no output it seems to hang completely. For context, dtGlobal contains 12 million rows and dtSensor contains 400 000.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtSensor = Open( "D:\\Project JMP\\IDEnorme\\TPMS_Sensor_install_DATA.jmp", Invisible );
dtGlobal = Open( "D:\\Project JMP\\Tables Données\\TableID Globale.jmp", Invisible );

hexList = Column( dtSensor, "ID_HEX" ) &amp;lt;&amp;lt; Get Values;

rows_of_interest = dtGlobal &amp;lt;&amp;lt; Get Rows Where(
    Contains( hexList, :ID )
);
dtResult = dtGlobal &amp;lt;&amp;lt; Subset(
    Rows( rows_of_interest ),
    Select( 
        :Ref Produit, 
        :ProductName 
    ),
    Output Table Name( "Résultats Correspondance" )
);

dtResult &amp;lt;&amp;lt; Show Window;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Jul 2025 15:10:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885606#M104833</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2025-07-09T15:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Matching ID_HEX List to Global Reference Table</title>
      <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885689#M104835</link>
      <description>&lt;P&gt;You can get rid off the duplicates on your&amp;nbsp;dtSensor for example by using Summarize, it will help slightly&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Summarize(dtSensor, hexList = By(:ID_HEX));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Jul 2025 15:15:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/885689#M104835</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-09T15:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Matching ID_HEX List to Global Reference Table</title>
      <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/886092#M104838</link>
      <description>&lt;P&gt;using an associative array, you should see &amp;lt;2 minutes&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtSensor = Open( "$DESKTOP/TPMS_Sensor_install_DATA.jmp" );
hexList = Column( dtSensor, "ID_HEX" ) &amp;lt;&amp;lt; Get Values; //1048575 
lookup = Associative Array( hexList );//231356
hexList = lookup &amp;lt;&amp;lt; getkeys; // the keep list.
// manufacture a 12 million row table with 50% matches
n = 12e6; // about 1/4 minute to build a test table...
dtGlobal = New Table( "Untitled",
	Add Rows( n ),
	New Column( "ID_HEX",
		Character,
		"Nominal",
		Set Values( Transform Each( {v}, Repeat( {"1", "0"}, n / 2 ), If( v == "1", "badc0de", hexlist[Random Integer( 1, N Items( hexlist ) )] ) ) )
	),
	New Column( "Ref Produit", setvalues( 1 :: n ) ), // even rows match the keep list
	New Column( "ProductName", setvalues( 1 :: n ) ) // odd rows are badc0de, not in keep list
);


unwantedrows = dtGlobal &amp;lt;&amp;lt; get rows where( !(lookup &amp;lt;&amp;lt; Contains( ID_HEX )) ); // about a minute to identify the rows

dtGlobal &amp;lt;&amp;lt; deleterows( unwantedrows );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jul 2025 19:56:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/886092#M104838</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2025-07-09T19:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Matching ID_HEX List to Global Reference Table</title>
      <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/886118#M104842</link>
      <description>&lt;P&gt;I removed duplicates from both data tables as Jthi suggested, used the associative‐array method, and it worked !&lt;BR /&gt;Thanks so much for the help !&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jul 2025 22:23:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/886118#M104842</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2025-07-09T22:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Matching ID_HEX List to Global Reference Table</title>
      <link>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/886164#M104850</link>
      <description>&lt;P&gt;I would suggest using Summarize if just the &lt;STRONG&gt;list is being utilized AND the values are strings&lt;/STRONG&gt;. Using associative array for just duplicate removal does get slow with larger datasets. Summary table is fastest with large data tables, but it does require slightly more code, but it does have benefits such as keeping numbers as numbers. The ordering may also be different between Associative Array and Summary/Summarize&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dttemp = Open("$DOWNLOADS/TPMS_Sensor_install_DATA.jmp");
hexList = Column(dttemp, "ID_HEX") &amp;lt;&amp;lt; Get Values;
lookup = Associative Array(hexList);
hexList = lookup &amp;lt;&amp;lt; getkeys;

n = 12e6; 
dt = New Table("Untitled",
	Add Rows(n),
	New Column("ID_HEX",
		Character,
		"Nominal",
		Set Values(
			Transform Each({v}, Repeat({"1", "0"}, n / 2),
				If(v == "1",
					"badc0de",
					uniq[Random Integer(1, N Items(uniq))]
				)
			)
		)
	),
	Private
);
Close(dttemp, no save);

wait(0);
s = Tick Seconds();
Summarize(dt, uniq_summarize = By(:ID_HEX));
wait(0);
summarize_dur = Tick Seconds() - s;
wait(0);


s = Tick Seconds();
uniq_aa = Associative Array(:ID_HEX) &amp;lt;&amp;lt; get keys;
wait(0);
aa_dur = Tick Seconds() - s;
wait(0);


s = Tick Seconds();
vals = Column(dt, "ID_HEX") &amp;lt;&amp;lt; Get Values;
aa = Associative Array(vals);
uniq_aa2 = Associative Array(aa) &amp;lt;&amp;lt; get keys;
wait(0);
aa2_dur = Tick Seconds() - s;
wait(0);


s = Tick Seconds();
dt_summary = dt &amp;lt;&amp;lt; Summary(
	Group(:ID_HEX),
	Freq("None"),
	Weight("None"),
	output table name("Summary of Untitled grouped by ID_HEX"),
	Private
);
uniq_summary = dt_summary[0, 1];
Close(dt_summary, no save);
wait(0);
summary_dur = Tick Seconds() - s;

Close(dt, no save);
Show(N Items(uniq_summarize), N Items(uniq_aa), N Items(uniq_aa2), N Items(uniq_summary));
Show(summarize_dur, aa_dur, aa2_dur, summary_dur);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;N Items(uniq_summarize) = 231357;
N Items(uniq_aa) = 231357;
N Items(uniq_aa2) = 231357;
N Items(uniq_summary) = 231357;
summarize_dur = 2.36666666666861;
aa_dur = 32.5166666666628;
aa2_dur = 32.25;
summary_dur = 1.30000000000291;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Depending on the real data, this can most likely made quite fast as there aren't too many rows for JMP to easily handle.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2025 06:35:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Matching-ID-HEX-List-to-Global-Reference-Table/m-p/886164#M104850</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-07-10T06:35:29Z</dc:date>
    </item>
  </channel>
</rss>

