<?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 Update Table Matching Columns Based on List in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922334#M108110</link>
    <description>&lt;P&gt;I'm using this simple update function to update a table based on the column matching below&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( dt_summary ),
	Match Columns( :DIE = :DIE, :RU = :RU, :NAME = :NAME, :TEST = :TEST )	
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, sometime the input table has DIE, RU, NAME or TEST columns missing, so I would like to update this column matching criteria depending on the input table. I tried several methods that didn't work, any suggestions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jan 2026 21:00:10 GMT</pubDate>
    <dc:creator>ClassDendrogram</dc:creator>
    <dc:date>2026-01-06T21:00:10Z</dc:date>
    <item>
      <title>Update Table Matching Columns Based on List</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922334#M108110</link>
      <description>&lt;P&gt;I'm using this simple update function to update a table based on the column matching below&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( dt_summary ),
	Match Columns( :DIE = :DIE, :RU = :RU, :NAME = :NAME, :TEST = :TEST )	
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, sometime the input table has DIE, RU, NAME or TEST columns missing, so I would like to update this column matching criteria depending on the input table. I tried several methods that didn't work, any suggestions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jan 2026 21:00:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922334#M108110</guid>
      <dc:creator>ClassDendrogram</dc:creator>
      <dc:date>2026-01-06T21:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Update Table Matching Columns Based on List</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922337#M108112</link>
      <description>&lt;P&gt;Here's an ugly solution.&amp;nbsp; I don't like using Eval( Parse(....) )&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
update_exp = Expr(
	dt &amp;lt;&amp;lt; Update( With( dt_summary ), _matchy_ )
);
match_exp = Expr( Match Columns() );
For Each( {v, i}, {"DIE", "RU", "NAME", "TEST"},
	If( dt_summary &amp;lt;&amp;lt; Has Column( v ),
		Eval( Parse( "Insert Into( match_exp, Expr( \!"" || v || "\!" = \!"" || v || "\!" ) );" ) )
	)
);
Eval( Substitute( update_exp, Expr( _matchy_ ), Name Expr( match_exp ) ) );
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Jan 2026 22:00:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922337#M108112</guid>
      <dc:creator>mmarchandFSLR</dc:creator>
      <dc:date>2026-01-06T22:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Update Table Matching Columns Based on List</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922338#M108113</link>
      <description>&lt;P&gt;Here is a simple example of one way to handle this.&amp;nbsp; Using the Big Class data table, the code will work if the age column is present or not present&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = 
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

// Subset data table
// → Data Table( "Subset of Big Class" )
dt2 = dt &amp;lt;&amp;lt; Subset( All rows, columns( :name, :age, :weight ) );

// Delete columns
dt &amp;lt;&amp;lt; Delete Columns( :weight );

colList = {};
If( Try( dt:name &amp;lt;&amp;lt; get name ) == "name" &amp;amp; Try( dt2:name &amp;lt;&amp;lt; get name ) == "name",
	Insert Into( colList, Expr( :Name == :Name ) )
);
If( Try( dt:age &amp;lt;&amp;lt; get name ) == "age" &amp;amp; Try( dt2:age &amp;lt;&amp;lt; get name ) == "age",
	Insert Into( colList, Expr( :age == :age ) )
);


dt &amp;lt;&amp;lt; Update(
	With( dt2 ),
	Match Columns( colList )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Jan 2026 22:15:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922338#M108113</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2026-01-06T22:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Update Table Matching Columns Based on List</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922352#M108115</link>
      <description>&lt;P&gt;Thank you, this worked just as expected!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 06:25:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922352#M108115</guid>
      <dc:creator>ClassDendrogram</dc:creator>
      <dc:date>2026-01-07T06:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update Table Matching Columns Based on List</title>
      <link>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922365#M108120</link>
      <description>&lt;P&gt;I haven't verified if this works correctly but you can have a list of "possible update columns" and compare that to both tables to build the final update list. This example requires JMP19 due to Set Intersection. In earlier versions of JMP you could use associative arrays instead&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt1 = Open("$SAMPLE_DATA/Big Class.jmp");
dt2 = Open("$SAMPLE_DATA/Big Class Families.jmp");

dt2 &amp;lt;&amp;lt; Delete Columns("sex");
dt2 &amp;lt;&amp;lt; Delete Rows(1::40::2);


possible_updatecols = {"name", "age", "sex"};

dt1cols = dt1 &amp;lt;&amp;lt; Get Column Names("String");
dt2cols = dt2 &amp;lt;&amp;lt; Get Column Names("String");

updatecols = Set Intersection(possible_updatecols, dt1cols);
updatecols = Set Intersection(updatecols, dt2cols); 

dt1 &amp;lt;&amp;lt; Update(
	With(dt2),
	Match(updatecols)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the column names are &lt;STRONG&gt;always the same&lt;/STRONG&gt; I think you can just use the list of columns with the Match.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 07:33:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-Table-Matching-Columns-Based-on-List/m-p/922365#M108120</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-01-07T07:33:50Z</dc:date>
    </item>
  </channel>
</rss>

