<?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: Joining tables with JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17368#M15825</link>
    <description>&lt;P&gt;What I suggest, is that you run your script down to where you are going to do the join.&amp;nbsp; But don't run the join.&amp;nbsp; Then go into interactive JMP, Tables==&amp;gt;Join&amp;nbsp;&amp;nbsp; and do the join manually, just the way you want it to be done.&amp;nbsp; Once that is complete, go to the newly joined data table, and go to the tables panel and click on the "Source" red triangle, and Edit the code.&amp;nbsp; There you will find the code you need to join the data the way you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally, I have made some minor changes to your script, which does not change the functionality of the code, but makes the code more precise:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// open and retain a reference
 
dt = Open("P:\CompComercialDPK\Inteligencia de Mercado DPK\Theodora\Projetos\Áreas de Influência\Estudos Preliminares\Raio 50 KM - DF.xlsx");
 
// criando a coluna de cidades, oncatenando cidade e estado
       dt&amp;lt;&amp;lt; New Column( "Cidades",
              Character,
              Nominal,
              Formula(:Nome || ", " || :Estado ),
              Set Selected
       );
 
// Abre a base de dados de vendas de 2015 
dt2 = Open("P:\CompComercialDPK\Inteligencia de Mercado DPK\Theodora\Projetos\Áreas de Influência\Vendas 2015.xlsx");
 
// criando a coluna de cidades, concatenando cidade e estado
 
       dt2&amp;lt;&amp;lt; New Column( "Cidades",
              Character,
              Nominal,
              Formula(:Desc. Município Cadastro || ", " || :Cód. U.F. Cadastro ),
              Set Selected
       );
 
//TA DANDO ERRO AQUI MINA
 
// Join para obter vendas e clientes das cidades
       dtjoined= dt &amp;lt;&amp;lt; Join(
              With( dt2 ),
              By Matching Columns( :Cidades = :Cidades ),
              Drop multiples( 0, 0 ),
              Name( "Include non-matches" )(1, 0),
              Preserve main table order( 1 )
       )
);
       dtjoined&amp;lt;&amp;lt; New Column( "MKT Share",
              Numeric, Continuous, Formula(:Name("Sum(Vlr. Venda Comercial)") /
               (:Name("Mean(Pot. Consumo Estimado por Categoria (2015) - Manutenção e acessórios/)") * 0.127)),
              Set Selected
       );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jun 2018 20:15:50 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-06-21T20:15:50Z</dc:date>
    <item>
      <title>Joining tables with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17366#M15823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm a begginer at using JSL, and tried to join two data tables using JSL. However, the code isn't working: it returns a table with empty columns &lt;SPAN __jive_emoticon_name="sad" __jive_macro_name="emoticon" class="jive_emote jive_macro" src="https://community.jmp.com/7.0.4.3b79b96/images/emoticons/sad.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 14:26:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17366#M15823</guid>
      <dc:creator>theo_beluzzi</dc:creator>
      <dc:date>2016-03-08T14:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Joining tables with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17367#M15824</link>
      <description>&lt;P&gt;Hard to tell why it's not working without some data to test things, but I made a few corrections/additions to your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. You used the same table variable (dt) for both tables.&amp;nbsp; Changed this to dt1 and dt2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Added table variables for creating the new formula columns&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Use table variables dt1 and dt2 in the join command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Added "output table" to the join command, then point dt3 to the joined output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Use dt3 table variable for adding the new column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// open and retain a reference
 
dt1 = Open("P:\CompComercialDPK\Inteligencia de Mercado DPK\Theodora\Projetos\Áreas de Influência\Estudos Preliminares\Raio 50 KM - DF.xlsx");
 
// criando a coluna de cidades, concatenando cidade e estado
dt1 &amp;lt;&amp;lt; New Column( "Cidades", Character, Nominal, Formula( :Nome || ", " || :Estado ), Set Selected    );
// Abre a base de dados de vendas de 2015 
dt2 = Open("P:\CompComercialDPK\Inteligencia de Mercado DPK\Theodora\Projetos\Áreas de Influência\Vendas 2015.xlsx");
 
// criando a coluna de cidades, concatenando cidade e estado
      
dt2 &amp;lt;&amp;lt; New Column( "Cidades", Character, Nominal, Formula( :Desc. Município Cadastro || ", " || :Cód. U.F. Cadastro ),
            Set Selected );
 
//TA DANDO ERRO AQUI MINA
// Join para obter vendas e clientes das cidades
      
(dt1 &amp;lt;&amp;lt; Join(
            With( dt2 ),
            By Matching Columns( :Cidades = :Cidades ),
            Drop multiples( 0, 0 ),
            Name( "Include non-matches" )(1, 0),
            Preserve main table order( 1 ),
            output table("Joined Table")
      )
);
 
dt3 = data table("Joined Table");
 
dt3 &amp;lt;&amp;lt;      New Column( "MKT Share", Numeric, Continuous,
            Formula(:Name("Sum(Vlr. Venda Comercial)") / (:Name("Mean(Pot. Consumo Estimado por Categoria (2015) - Manutenção e acessórios/)") * 0.127)),
            Set Selected
      );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 20:14:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17367#M15824</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2018-06-21T20:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Joining tables with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17368#M15825</link>
      <description>&lt;P&gt;What I suggest, is that you run your script down to where you are going to do the join.&amp;nbsp; But don't run the join.&amp;nbsp; Then go into interactive JMP, Tables==&amp;gt;Join&amp;nbsp;&amp;nbsp; and do the join manually, just the way you want it to be done.&amp;nbsp; Once that is complete, go to the newly joined data table, and go to the tables panel and click on the "Source" red triangle, and Edit the code.&amp;nbsp; There you will find the code you need to join the data the way you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally, I have made some minor changes to your script, which does not change the functionality of the code, but makes the code more precise:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// open and retain a reference
 
dt = Open("P:\CompComercialDPK\Inteligencia de Mercado DPK\Theodora\Projetos\Áreas de Influência\Estudos Preliminares\Raio 50 KM - DF.xlsx");
 
// criando a coluna de cidades, oncatenando cidade e estado
       dt&amp;lt;&amp;lt; New Column( "Cidades",
              Character,
              Nominal,
              Formula(:Nome || ", " || :Estado ),
              Set Selected
       );
 
// Abre a base de dados de vendas de 2015 
dt2 = Open("P:\CompComercialDPK\Inteligencia de Mercado DPK\Theodora\Projetos\Áreas de Influência\Vendas 2015.xlsx");
 
// criando a coluna de cidades, concatenando cidade e estado
 
       dt2&amp;lt;&amp;lt; New Column( "Cidades",
              Character,
              Nominal,
              Formula(:Desc. Município Cadastro || ", " || :Cód. U.F. Cadastro ),
              Set Selected
       );
 
//TA DANDO ERRO AQUI MINA
 
// Join para obter vendas e clientes das cidades
       dtjoined= dt &amp;lt;&amp;lt; Join(
              With( dt2 ),
              By Matching Columns( :Cidades = :Cidades ),
              Drop multiples( 0, 0 ),
              Name( "Include non-matches" )(1, 0),
              Preserve main table order( 1 )
       )
);
       dtjoined&amp;lt;&amp;lt; New Column( "MKT Share",
              Numeric, Continuous, Formula(:Name("Sum(Vlr. Venda Comercial)") /
               (:Name("Mean(Pot. Consumo Estimado por Categoria (2015) - Manutenção e acessórios/)") * 0.127)),
              Set Selected
       );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 20:15:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17368#M15825</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-06-21T20:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Joining tables with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17369#M15826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked! Thanks, man!&lt;/P&gt;&lt;P&gt;How can i rename the dt3? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 16:58:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17369#M15826</guid>
      <dc:creator>theo_beluzzi</dc:creator>
      <dc:date>2016-03-08T16:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Joining tables with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17370#M15827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dt3 &amp;lt;&amp;lt; set name("the new name");&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 17:33:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17370#M15827</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2016-03-08T17:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Joining tables with JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17371#M15828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yaay, thaanks! &lt;SPAN __jive_emoticon_name="grin" __jive_macro_name="emoticon" class="jive_emote jive_macro" src="https://community.jmp.com/7.0.4.3b79b96/images/emoticons/grin.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2016 17:37:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Joining-tables-with-JSL/m-p/17371#M15828</guid>
      <dc:creator>theo_beluzzi</dc:creator>
      <dc:date>2016-03-08T17:37:52Z</dc:date>
    </item>
  </channel>
</rss>

