<?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: Mapping Columns in two different Tables by manual Selection using JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879327#M104262</link>
    <description>&lt;P&gt;Hi Jarmo, Thank you so much. It is very helpful. In your code you compare first columns of each table. Can we modify it where specific column of one table at random location can be compared to a specific column ( irrespective of column number) in the second table?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jun 2025 04:38:42 GMT</pubDate>
    <dc:creator>NewToThis</dc:creator>
    <dc:date>2025-06-11T04:38:42Z</dc:date>
    <item>
      <title>Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878440#M104135</link>
      <description>&lt;P&gt;I have two tables, let call them dt1 and dt2&lt;/P&gt;
&lt;P&gt;Each table has one column each Column1 in dt1 and column2 in dt2.&lt;/P&gt;
&lt;P&gt;I need to (either update or create a new table ) that has contents of Column1 mapped to to contents of Column2 by manual selection. Since the column entities are so different a join or update feature cannot be used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My aim is to create a user interface that allows the user to select row by row matching of content in the two columns.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NewToThis_0-1749143273299.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/76573i24A213D9C8A13A6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NewToThis_0-1749143273299.png" alt="NewToThis_0-1749143273299.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 17:09:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878440#M104135</guid>
      <dc:creator>NewToThis</dc:creator>
      <dc:date>2025-06-05T17:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878450#M104136</link>
      <description>&lt;P&gt;Would the &lt;A href="https://www.jmp.com/support/help/en/18.1/index.shtml#page/jmp/recode-data-in-a-column.shtml#ww1088306" target="_self"&gt;"Apply Mapping from Table" option in the Recode platform&lt;/A&gt; be useful for your situation? If so, it can be incorporated into a script.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 17:40:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878450#M104136</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2025-06-05T17:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878452#M104137</link>
      <description>&lt;P&gt;Hi Jed_campbell,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately no. This assume that a list exists that maps one column to another. I am practically trying to create such a list.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So for this question purpose let assume that I have only two tables dt1 and dt2 and each of them has only one column, column1 and column2 respectively and I want to map some contents of column 1 to contents of column2. ( I use "some contents" because the number of rows in the two columns is different)&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 18:17:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878452#M104137</guid>
      <dc:creator>NewToThis</dc:creator>
      <dc:date>2025-06-05T18:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878463#M104138</link>
      <description>&lt;P&gt;Ah, something like this should work for you then, assuming I'm understanding correctly. You'd replace the first 2 tables with your own.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jed_Campbell_0-1749149089384.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/76575i30E56649BD477FA8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Jed_Campbell_0-1749149089384.png" alt="Jed_Campbell_0-1749149089384.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt1 = New Table( "Table 1",
	Add Rows( 4 ),
	New Column( "Choice1", Character, "Nominal", Set Values( {"A", "B", "C", "D"} ) )
);

dt2 = New Table( "Table 2",
	Add Rows( 5 ),
	New Column( "Choice2", Character, "Nominal", Set Values( {"L", "M", "N", "O", "P"} ) )
);

dtlookup = New Table( "lookuptable",
	Add Rows( 0 ),
	New Column( "dt1choice", Character, "Nominal" ),
	New Column( "dt2choice", Character, "Nominal" )
);
lst1 = Associative Array( dt1:Choice1 ) &amp;lt;&amp;lt; get keys;
lst2 = Associative Array( dt2:Choice2 ) &amp;lt;&amp;lt; get keys;



nw = New Window( "Chooser",
	H List Box(
		lb1 = List Box( lst1, max selected( 1 ) ),
		lb2 = List Box( lst2, max selected( 1 ) ), 
		
	),
	Button Box( "Make Match",
		dtlookup &amp;lt;&amp;lt; add rows(
			{dt1choice = (lb1 &amp;lt;&amp;lt; get selected)[1], dt2choice = (lb2 &amp;lt;&amp;lt; get selected)[1]}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 18:45:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878463#M104138</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2025-06-05T18:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878477#M104139</link>
      <description>&lt;P&gt;Hi Jed_Campbell, This should in principle work but I get the following error when trying to run this code on already opened tables dt1 with Column Choice1 and dt2 with Column Choice2. I am using JMP17.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scoped data table access requires a data table column or variable in access or evaluation of 'dt1:Choice1' , dt1:Choice1/*###*/&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 19:24:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878477#M104139</guid>
      <dc:creator>NewToThis</dc:creator>
      <dc:date>2025-06-05T19:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878478#M104140</link>
      <description>&lt;P&gt;I fixed the issue. Thank you so much for your help. This is working now&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 19:28:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878478#M104140</guid>
      <dc:creator>NewToThis</dc:creator>
      <dc:date>2025-06-05T19:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878479#M104141</link>
      <description>&lt;P&gt;Here is very quickly thrown together UI which slightly follows JMP's table join/update platforms&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*""" Map two columns together

Author: jthi
Creation Date: 2025-06-05
Creation JMP Version: JMP Pro 18.2.0
	
"""*/


Names Default To Here(1);

dt1 = New Table("Untitled", New Column("Column 1", Character, "Nominal", Set Values({"A", "B", "C"})));
dt2 = New Table("Untitled", New Column("Column 2", Character, "Nominal", Set Values({"E", "F", "G", "H"})));


nw = New Window("Matcher",
	Lineup Box(N Col(3),
		V List Box(
			Panel Box("From - Table: " || (dt1 &amp;lt;&amp;lt; get name || ", Column: " || (Column(dt1, 1) &amp;lt;&amp;lt; get name)),
				window:lb_from = List Box(Column(dt1, 1) &amp;lt;&amp;lt; get values)
			),
			Panel Box("To - Table: " || (dt2 &amp;lt;&amp;lt; get name || ", Column: " || (Column(dt2, 1) &amp;lt;&amp;lt; get name)),
				window:lb_to = List Box(Column(dt2, 1) &amp;lt;&amp;lt; get values)
			)
		),
		Panel Box("Match",
			H List Box(align("top"),
				Button Box("Match", 
				&amp;lt;&amp;lt; Set Function(function({this},
					from_selections = window:lb_from &amp;lt;&amp;lt; get selected;
					to_selections = window:lb_to &amp;lt;&amp;lt; get selected;
					pairs = {};
					For Each({{from, to}}, Across(from_selections, to_selections, Count("Shortest")),
						Insert Into(pairs, Eval Insert("^from^=^to^"));
					);
					window:lb_match &amp;lt;&amp;lt; Append(pairs);
				))),
				window:lb_match = List Box({}, &amp;lt;&amp;lt; Set N Lines(20))
			)
		),
		Panel Box("Actions",
			Lineup Box(N Col(1),
				Button Box("OK", &amp;lt;&amp;lt; Set Function(function({this},
					selections = window:lb_match &amp;lt;&amp;lt; get items;
					from_values = {};
					to_values = {};
					For Each({selection}, selections,
						{from, to} = Words(selection, "=");
						Insert Into(from_values, from);
						Insert Into(to_values, to);
					);
					dt_result = New Table(Eval Insert("^(dt1 &amp;lt;&amp;lt; get name)^ mapped to ^(dt2 &amp;lt;&amp;lt; get name)^"),
						New Column(Column(dt1, 1) &amp;lt;&amp;lt; get name, Character, Nominal, Values(from_values)),
						New Column(Column(dt2, 1) &amp;lt;&amp;lt; get name, Character, Nominal, Values(to_values))
					);
					If(!(window:cb_keepdialog &amp;lt;&amp;lt; get),
						this &amp;lt;&amp;lt; close window;
					);
				))),
				Button Box("Cancel", &amp;lt;&amp;lt; Set Function(function({this}, this &amp;lt;&amp;lt; close window))),
				Spacer Box(Size(0, 10)),
				Button Box("Remove",
					window:lb_match &amp;lt;&amp;lt; Remove Selected();
				),
				window:cb_keepdialog = Check Box({"Keep Dialog Open"}, &amp;lt;&amp;lt; Set All(1))
			)
		)
	)
);

Write();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;There are plenty of improvements which could be done such as column selection, cleaning UI, error handling, ...&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 20:05:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/878479#M104141</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-06-05T20:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879327#M104262</link>
      <description>&lt;P&gt;Hi Jarmo, Thank you so much. It is very helpful. In your code you compare first columns of each table. Can we modify it where specific column of one table at random location can be compared to a specific column ( irrespective of column number) in the second table?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 04:38:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879327#M104262</guid>
      <dc:creator>NewToThis</dc:creator>
      <dc:date>2025-06-11T04:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879329#M104264</link>
      <description>&lt;P&gt;It can easily be modified in such a way. Would the user pick column from the first table and then it is assumed same column exist in second table? Or should user be able to pick columns from both tables?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 04:43:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879329#M104264</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-06-11T04:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879489#M104284</link>
      <description>&lt;P&gt;Preferably, user should be able to pick columns from both the tables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 20:04:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879489#M104284</guid>
      <dc:creator>NewToThis</dc:creator>
      <dc:date>2025-06-11T20:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879518#M104287</link>
      <description>&lt;P&gt;I assume it would just be single column from both tables? I should have time today to add needed updates to the script.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 06:04:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879518#M104287</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-06-12T06:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Columns in two different Tables by manual Selection using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879610#M104298</link>
      <description>&lt;P&gt;Creating this will take longer than I expected as user has to be also able to pick the second table which makes it very messy due to how all "nice" display boxes behave when tables change (looking at filter col selector and col list box...). And I have less time in the evening than I hoped I would have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also started creating more complicated UI but I realized that there really isn't a point as JMP's Recode platform should do all this. I suggest you create a wish list item about this (I can also create one, I do have few extra suggestions also)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1749738216836.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/76850iB1EC4A6C76D70038/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1749738216836.png" alt="jthi_0-1749738216836.png" /&gt;&lt;/span&gt;&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 14:29:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mapping-Columns-in-two-different-Tables-by-manual-Selection/m-p/879610#M104298</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-06-12T14:29:15Z</dc:date>
    </item>
  </channel>
</rss>

