<?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: Getting table from MakeQueryTable Geoprocessing result in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325115#M10300</link>
    <description>&lt;P&gt;Link, I suggested you, contains different geodatabase access code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MemoryConnectionProperties memoryConnectionProperties = new MemoryConnectionProperties();
Geodatabase geodatabase = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties);&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 03 Sep 2023 18:27:39 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2023-09-03T18:27:39Z</dc:date>
    <item>
      <title>Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325090#M10297</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am creating a table using the following code.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public async Task MakeQueryTable() {

    var created = await QueuedTask.Run(() =&amp;gt; {
        
        bool tableCreated = false;
        string featureClassPath = @"c:\temp\test.gdb\in_featureclass";
        string tablePath = @"c:\temp\test.gdb\in_datatable";

        var valueArray = Geoprocessing.MakeValueArray(featureClassPath + ";" + tablePath, "queryTable", "USE_KEY_FIELDS", null,
            "in_featureclass.OBJECTID #; in_featureclass.ID #; in_featureclass.NAME #; in_datatable.ID #; in_datatable.NAME",
            "in_featureclass.ID = in_datatable.ID And in_featureclass.NAME = in_datatable.NAME");
        
        // Execute the task and DO NOT add the table to the current map!
        Task&amp;lt;IGPResult&amp;gt; gp_result = Geoprocessing.ExecuteToolAsync("management.MakeQueryTable", valueArray, flags: GPExecuteToolFlags.None);

        IGPResult makeTableResult = gp_result.Result;
        // makeTableResult now contains the name "queryTable"

        // Trying to open the table via 
        string newTablePath = @"c:\temp\test.gdb\" + makeTableResult.ReturnValue;

        // Opening this table leads to an error not able to open this table, because it dous not exist in Filegeodatabase

        // If you use GPExecuteToolFlags.AddOutputsToMap in ExecuteToolAsync then you can reference the table in the map
        var newStandaloneTable = MapView.Active.Map.GetStandaloneTablesAsFlattenedList().Where((l) =&amp;gt; l.Name == "queryTable").FirstOrDefault() as StandaloneTable;

        return tableCreated;
    });
}&lt;/LI-CODE&gt;&lt;P&gt;I used the option&amp;nbsp;GPExecuteToolFlags.None, because the result is just a temporary table.&lt;/P&gt;&lt;P&gt;After executing the code, I found no way to get the table object from the GP-Result.&lt;/P&gt;&lt;P&gt;There is a workaround. When you add the table to the active map, the you can find the table there.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var newStandaloneTable = MapView.Active.Map.GetStandaloneTablesAsFlattenedList().Where((l) =&amp;gt; l.Name == "queryTable").FirstOrDefault() as StandaloneTable;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get the table object without adding the result to the active map?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 16:56:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325090#M10297</guid>
      <dc:creator>AndreasMarth</dc:creator>
      <dc:date>2023-09-02T16:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325093#M10298</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For the output path you can use the "memory" workspace (as noted&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-DDL#memory-geodatabases" target="_self" rel="nofollow noopener noreferrer"&gt;here&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Look at this thread too:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-copy-feature-class-to-in-memory-geodatabase/m-p/1137531" target="_blank"&gt;Solved: How to copy feature class to in memory geodatabase - Esri Community&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 18:59:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325093#M10298</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-09-02T18:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325108#M10299</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thanks for your answer, but it seems that using a Memory Workspace does not work either. Same behaviour when I use the following code.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;...
Geodatabase memGDB = new Geodatabase(memoryConnectionProperties);
var valueArray = Geoprocessing.MakeValueArray(featureClassPath + ";" + tablePath, @"memory\queryTable", "USE_KEY_FIELDS", ...

Task &amp;lt; IGPResult &amp;gt; gp_result = Geoprocessing.ExecuteToolAsync("management.MakeQueryTable", valueArray, flags: GPExecuteToolFlags.None);
...
// Leads to an error which says "Table does not exists"
Table resultTable = memGDB.OpenDataset&amp;lt;Table&amp;gt;("queryTable");&lt;/LI-CODE&gt;&lt;P&gt;The task will be executed without any errors when using a memory GDB and returns a value containing "memory\queryTable", but I cant open/reference&amp;nbsp; the result table. Try to open the table leads to the error "Table does not exist". Any ideas?&lt;/P&gt;&lt;P&gt;By the way, I am using version SDK version 3.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Sep 2023 10:01:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325108#M10299</guid>
      <dc:creator>AndreasMarth</dc:creator>
      <dc:date>2023-09-03T10:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325115#M10300</link>
      <description>&lt;P&gt;Link, I suggested you, contains different geodatabase access code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MemoryConnectionProperties memoryConnectionProperties = new MemoryConnectionProperties();
Geodatabase geodatabase = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties);&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 03 Sep 2023 18:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325115#M10300</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-09-03T18:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325154#M10301</link>
      <description>&lt;P&gt;Hi Gintautas,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your reply, but using SchemaBuilder doesn't change anything, same result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way,&amp;nbsp;I am not sure, if a Memory GeoDB can be used at all with "MakeQueryTable", because the result table is just a table name and not a full dataset name, and therefor the table should be always created&amp;nbsp; somewhere in the source database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I add the result table to active map, the properties of the table contain the path of the input source datasets. But you cannot see the table when you try to open the table with standard functions, is must be some kind of temporary table, which is not displayed in the open dataset window.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 06:57:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325154#M10301</guid>
      <dc:creator>AndreasMarth</dc:creator>
      <dc:date>2023-09-04T06:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325190#M10303</link>
      <description>&lt;P&gt;This but there’s a lot of wonky things it doesn’t like. Basically any calculations or nests. We make views and publish them as a referenced feature layers. There’s virtually no documentation about the quirks with sql and feature layers&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://mobdro.bio/" target="_blank" rel="noopener"&gt;https://mobdro.bio/&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 08:39:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325190#M10303</guid>
      <dc:creator>raven403</dc:creator>
      <dc:date>2023-09-07T08:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325233#M10306</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have tried to make sample with output "memory\QueryTable". I have added parameter to geoprocessing tool to add result to map.&amp;nbsp; Geoprocessing created query table in my enterprise database where input data was located.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 19:01:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325233#M10306</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-09-04T19:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325319#M10309</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;there is no problem when you use a Memory database, when input data is located in this database,&amp;nbsp; and also no problem when you use the option "&lt;SPAN&gt;add result to map&lt;/SPAN&gt;" (you can then locate the result table in the active view).&lt;/P&gt;&lt;P&gt;The main question was: &lt;STRONG&gt;How to get the table object from the GPResult created by "MakeQueryTable" when you do NOT add the result to the current map view.&lt;/STRONG&gt;&amp;nbsp; I guess there is no difference when you use a MemoryDatabase or a FGDB on disk.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 08:26:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325319#M10309</guid>
      <dc:creator>AndreasMarth</dc:creator>
      <dc:date>2023-09-05T08:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325333#M10310</link>
      <description>&lt;P&gt;I have added result to map to check result source path only. At it shows what the result was created inside inputs database.&lt;/P&gt;&lt;P&gt;So If you want to have result in memory workspace, your inputs must be in memory workspace too.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 09:42:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325333#M10310</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-09-05T09:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325425#M10313</link>
      <description>&lt;P&gt;This is how I access the result of a geoprocessing tool when I don't add it to a map. This uses a memory geodatabase, but I have also done it using a regular geodatabase.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;bool results = await QueuedTask.Run(async () =&amp;gt;
{
  MemoryConnectionProperties memoryConnectionProperties = new();
  using Geodatabase geodatabase = SchemaBuilder.CreateGeodatabase(memoryConnectionProperties);
  string path = "memory";

  //when I tested this using the geodatabase where the Featurelayer was stored, I used this code:
  //  using Geodatabase geodatabase = (Geodatabase)SelectedFrameFeatureLayer.GetFeatureClass().GetDatastore();
  //  string path = geodatabase.GetPath().AbsolutePath;

  IGPResult copyResult = await CopyFeatureClass(SelectedFrameFeatureLayer.GetFeatureClass(), path, "VirtualInputLayer", GPExecuteToolFlags.None);
  if (copyResult.IsFailed) return false;
  using FeatureClass virtualFC = geodatabase.OpenDataset&amp;lt;FeatureClass&amp;gt;("VirtualInputLayer");
  //
  // make calculations on the copied FC
  //
  return true;
});

    public static async Task&amp;lt;IGPResult&amp;gt; CopyFeatureClass(FeatureClass InFC, string OutputPath, string OutputName, GPExecuteToolFlags flags, string SQLExpression = null, string FieldMap = null, string ConfigurationKeyword = null)
    {
      List&amp;lt;object&amp;gt; arguments = new()
      {
        InFC, //Input features
        OutputPath, //Output location
        OutputName, //Output Name 
        SQLExpression, //Expression (optional)
        FieldMap, //Field Map optional)
        ConfigurationKeyword //Configuration Keyword (optional)
      };
      IGPResult result = await Geoprocessing.ExecuteToolAsync("conversion.FeatureClassToFeatureClass", Geoprocessing.MakeValueArray(arguments.ToArray()), null, null, null, flags);
      return result;
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 14:46:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325425#M10313</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-09-05T14:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325486#M10317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;thank you for your answer, but FeatureClassToFeatureClass creates a new Dataset and therefore the full path ist returned and you can open the newly created FeatureClass with the path returned by GPResult. MakeQueryTable works different and returns only a table Name and I have found no way so far to reference this table without adding the result table to the active map and then search for the table in the map.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 16:54:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325486#M10317</guid>
      <dc:creator>AndreasMarth</dc:creator>
      <dc:date>2023-09-05T16:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325508#M10319</link>
      <description>&lt;P&gt;Instead of using the geoprocessor to make the query table, can you use a query definition to make the query table from the geodatabase using the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14519.html" target="_self"&gt;OpenQueryTable&lt;/A&gt; method?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 17:24:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325508#M10319</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-09-05T17:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting table from MakeQueryTable Geoprocessing result</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325756#M10331</link>
      <description>&lt;P&gt;Hi KenBuja,&lt;/P&gt;&lt;P&gt;this is not the solution for my original question, but using the OpenQueryTable method is a perfect workaround for me.&amp;nbsp; Thank you so much for your help and have a good day.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 07:48:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-table-from-makequerytable-geoprocessing/m-p/1325756#M10331</guid>
      <dc:creator>AndreasMarth</dc:creator>
      <dc:date>2023-09-06T07:48:30Z</dc:date>
    </item>
  </channel>
</rss>

