<?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: Execute &amp;quot;Make Query Table&amp;quot;  tool using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/execute-amp-quot-make-query-table-amp-quot-nbsp/m-p/278042#M21473</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your tips Xander! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still cannot get the tool to work right with my local variables. The main issue is with the the expression and the field list. I want only some fields from the feature class and one field from the table. I was able to get the list of these fields and also the SQL expression that you suggested worked fine outside the tool. But once I compile all these variables into the tool in python, it fails. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ananya&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Feb 2014 15:56:47 GMT</pubDate>
    <dc:creator>AnanyaBaruah</dc:creator>
    <dc:date>2014-02-05T15:56:47Z</dc:date>
    <item>
      <title>Execute &amp;quot;Make Query Table&amp;quot;  tool using python</title>
      <link>https://community.esri.com/t5/python-questions/execute-amp-quot-make-query-table-amp-quot-nbsp/m-p/278040#M21471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to execute the Make Query Table tool using Python scripts following which I will incorporate other tools as well. I have set all the required parameters for the tool to run; the input feature class, input table, the field list and the expression, etc. However, I get a Runtime error that says "RuntimeError: Object: Error in executing tool".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am attaching the script here for your reference. I will really appreciate if someone can offer me some advice as to where I am making a mistake or what am I missing and how I can get this to work. I am a beginner with Python and any suggestions will be really helpful for me to build upon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank You!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 18:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/execute-amp-quot-make-query-table-amp-quot-nbsp/m-p/278040#M21471</guid>
      <dc:creator>AnanyaBaruah</dc:creator>
      <dc:date>2014-02-04T18:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Execute "Make Query Table"  tool using python</title>
      <link>https://community.esri.com/t5/python-questions/execute-amp-quot-make-query-table-amp-quot-nbsp/m-p/278041#M21472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ananya,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Tip 1&lt;/STRONG&gt;&lt;SPAN&gt;:specify a workspace without trailing slashes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;replace:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;inputPath = "F:\\GIS\\_Projects\\NPMRDS\\GDB\\NHS_npmrds_2013.gdb\\"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;by:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;inputPath = "F:\\GIS\\_Projects\\NPMRDS\\GDB\\NHS_npmrds_2013.gdb"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Tip 2&lt;/STRONG&gt;&lt;SPAN&gt;: It is better to use &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;os.path.join&lt;/SPAN&gt;&lt;SPAN&gt; to join a location and a name:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Add this to the beginning of the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and change your code to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;inputTable = os.path.join(inputPath, speedTable)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;(this should give the same result as you already had)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do the same for inputFC, tmpQueryTable, QueryTableFeatureClass:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;inputFC = os.path.join(inputPath, featureClass)
tmpQueryTable = os.path.join(inputPath, "QueryTable")
QueryTableFeatureClass = os.path.join(inputPath, "copyFeatures")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Tip 3&lt;/STRONG&gt;&lt;SPAN&gt;: your fieldList contains objects and not the&amp;nbsp; fully qualified field names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to get this right, the easiest way would be to execute the tool manually. See instructions here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000006r000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000006r000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After a successful run, open the "Results" window and right click on the successfully executed tool. This will reveal the option "Copy as Python Snippet". Now you are able to paste the python code to your Python IDE and examine what the content of each parameter has been. Adapt you script to create the same type of parameters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Tip 4&lt;/STRONG&gt;&lt;SPAN&gt;: expression is not valid&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The expression uses names of variables, but should use the content of the variables. Use this instead and verify if you need to use fully qualified names in the expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;expression = "{0} = {1}".format(tmc1, tmc4)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;this would yield: "NHS_tmc = tmc"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:32:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/execute-amp-quot-make-query-table-amp-quot-nbsp/m-p/278041#M21472</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T13:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Execute "Make Query Table"  tool using python</title>
      <link>https://community.esri.com/t5/python-questions/execute-amp-quot-make-query-table-amp-quot-nbsp/m-p/278042#M21473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your tips Xander! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still cannot get the tool to work right with my local variables. The main issue is with the the expression and the field list. I want only some fields from the feature class and one field from the table. I was able to get the list of these fields and also the SQL expression that you suggested worked fine outside the tool. But once I compile all these variables into the tool in python, it fails. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ananya&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2014 15:56:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/execute-amp-quot-make-query-table-amp-quot-nbsp/m-p/278042#M21473</guid>
      <dc:creator>AnanyaBaruah</dc:creator>
      <dc:date>2014-02-05T15:56:47Z</dc:date>
    </item>
  </channel>
</rss>

