<?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 Use a variable number of columns to join data tables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Use-a-variable-number-of-columns-to-join-data-tables/m-p/705644#M89013</link>
    <description>&lt;P&gt;Hello - I'm trying to do a join as part of a script. However, the "select" and "selectwith" parts are messing me up. I'm dynamically selecting columns of linked data tables earlier in the script, and and passing them as a list to the "select" and "select with" parts. I tried Eval(Eval Expr(Expr())), but that didn't work. I think I'm just misunderstanding the way those two actually take information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table(dt2b) &amp;lt;&amp;lt; Join(
    With(Data Table("Experimental Info")),
    Match Flag(1),
    Select(selectedCols1String),
    SelectWith(selectedCols2String),
    By Matching Columns(:ID = :ID),
    Drop multiples(0, 0),
    Include Nonmatches(0, 0),
    Preserve main table order(1)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The output for selectedCols1String and selectedCols2String look like this:&amp;nbsp;":ID, :2Theta, :Data, :Error, :Raw Data, :Raw Error"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2023 19:36:20 GMT</pubDate>
    <dc:creator>ehchandlerjr</dc:creator>
    <dc:date>2023-12-04T19:36:20Z</dc:date>
    <item>
      <title>Use a variable number of columns to join data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Use-a-variable-number-of-columns-to-join-data-tables/m-p/705644#M89013</link>
      <description>&lt;P&gt;Hello - I'm trying to do a join as part of a script. However, the "select" and "selectwith" parts are messing me up. I'm dynamically selecting columns of linked data tables earlier in the script, and and passing them as a list to the "select" and "select with" parts. I tried Eval(Eval Expr(Expr())), but that didn't work. I think I'm just misunderstanding the way those two actually take information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table(dt2b) &amp;lt;&amp;lt; Join(
    With(Data Table("Experimental Info")),
    Match Flag(1),
    Select(selectedCols1String),
    SelectWith(selectedCols2String),
    By Matching Columns(:ID = :ID),
    Drop multiples(0, 0),
    Include Nonmatches(0, 0),
    Preserve main table order(1)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The output for selectedCols1String and selectedCols2String look like this:&amp;nbsp;":ID, :2Theta, :Data, :Error, :Raw Data, :Raw Error"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 19:36:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-a-variable-number-of-columns-to-join-data-tables/m-p/705644#M89013</guid>
      <dc:creator>ehchandlerjr</dc:creator>
      <dc:date>2023-12-04T19:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use a variable number of columns to join data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Use-a-variable-number-of-columns-to-join-data-tables/m-p/705652#M89014</link>
      <description>&lt;P&gt;You shouldn't use a string but rather a list and use Eval with it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Trial1.jmp");
dt2 = Open("$SAMPLE_DATA/Little.jmp");

select_cols = {"popcorn", "oil amt", "batch", "yield"};
with_cols = {"yield", "batch"};

dt3 = dt &amp;lt;&amp;lt; Join(
	With(dt2),
	Select(Eval(select_cols)),
	SelectWith(Eval(with_cols)),
	By Matching Columns(:popcorn = :popcorn, :batch = :batch, :oil amt = :oil)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here I'm using list of strings, but those could be list references also&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Trial1.jmp");
dt2 = Open("$SAMPLE_DATA/Little.jmp");

select_cols = {:popcorn, :oil amt, :batch, :yield};
with_cols = {:yield, :batch};

dt3 = dt &amp;lt;&amp;lt; Join(
	With(dt2),
	Select(Eval(select_cols)),
	SelectWith(Eval(with_cols)),
	By Matching Columns(:popcorn = :popcorn, :batch = :batch, :oil amt = :oil)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Mon, 04 Dec 2023 19:42:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-a-variable-number-of-columns-to-join-data-tables/m-p/705652#M89014</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-12-04T19:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Use a variable number of columns to join data tables</title>
      <link>https://community.jmp.com/t5/Discussions/Use-a-variable-number-of-columns-to-join-data-tables/m-p/705659#M89015</link>
      <description>&lt;P&gt;Thank you so much!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 20:02:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Use-a-variable-number-of-columns-to-join-data-tables/m-p/705659#M89015</guid>
      <dc:creator>ehchandlerjr</dc:creator>
      <dc:date>2023-12-04T20:02:18Z</dc:date>
    </item>
  </channel>
</rss>

