ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / IStandaloneTableFactory Interface / CreateStandaloneTable Method / CreateStandaloneTable(Uri,IStandaloneTableContainerEdit,Int32,String) Method
An URI represents the path to a dataset
A map or group layer where the StandaloneTable will be added
The position of the StandaloneTable in the map or group layer. 0 represents the top most position.
System.String (optional) When not provided, the default display name gets used e.g. the dataset name or alias. (default value = "")
Example

In This Topic
    CreateStandaloneTable(Uri,IStandaloneTableContainerEdit,Int32,String) Method
    In This Topic
    Creates a new StandaloneTable instance with the specified path to a dataset and adds it to a container such as a map. Optionally you can provide a name to override the default display name. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Overloads Function CreateStandaloneTable( _
       ByVal tableUri As Uri, _
       ByVal container As IStandaloneTableContainerEdit, _
       Optional ByVal index As Integer, _
       Optional ByVal tableName As String _
    ) As StandaloneTable

    Parameters

    tableUri
    An URI represents the path to a dataset
    container
    A map or group layer where the StandaloneTable will be added
    index
    The position of the StandaloneTable in the map or group layer. 0 represents the top most position.
    tableName
    System.String (optional) When not provided, the default display name gets used e.g. the dataset name or alias. (default value = "")
    Example
    Add a GeoPackage to the Map
    {
      string pathToGeoPackage = @"C:\Data\Geopackage\flooding.gpkg";
      //Create lists to hold the URIs of the layers and tables in the geopackage
      var layerUris = new List<Uri>();
      var tableUris = new List<Uri>();
      await QueuedTask.Run(() =>
      {
        //Create an item from the geopackage
        var item = ItemFactory.Instance.Create(pathToGeoPackage, ItemFactory.ItemType.PathItem);
        var children = item.GetItems();
        //Collect the table and spatial data in the geopackage
        foreach (var child in children)
        {
          var childPath = child.Path;
    
          if (child.TypeID == "sqlite_table")
          {
            tableUris.Add(new Uri(childPath));
          }
          else
          {
            layerUris.Add(new Uri(childPath));
          }
        }
        //Add the spatial data in the geopackage using the BulkLayerCreationParams
        if (layerUris.Count > 0)
        {
          BulkLayerCreationParams bulklcp = new BulkLayerCreationParams(layerUris);
          LayerFactory.Instance.CreateLayers(bulklcp, map);
        }
        // add the tables separately
        foreach (var tableUri in tableUris)
        {
          StandaloneTableFactory.Instance.CreateStandaloneTable(tableUri, map);
        }
      });
    }
    Create a StandaloneTable
    {
      //container can be a map or group layer
      var container = map;
      //var container =  MapView.Active.Map.GetLayersAsFlattenedList()
      //                                  .OfType<GroupLayer>().First();
      await QueuedTask.Run(() =>
      {
        //use a local path
        var table = StandaloneTableFactory.Instance.CreateStandaloneTable(
            new Uri(@"C:\Temp\Data\SDK.gdb\EarthquakeDamage", UriKind.Absolute), container);
        //use a URI to a feature service table endpoint
        var table2 = StandaloneTableFactory.Instance.CreateStandaloneTable(
                      new Uri(@"https://bexdog.esri.com/server/rest/services/FeatureServer" + "/2", UriKind.Absolute), container);
        //Use an item
        var item = ItemFactory.Instance.Create(@"C:\Temp\Data\SDK.gdb\ParcelOwners");
        var tableCreationParams = new StandaloneTableCreationParams(item);
        var table3 = StandaloneTableFactory.Instance.CreateStandaloneTable(tableCreationParams, container);
    
        //use table creation params
        var table_params = new StandaloneTableCreationParams(item)
        {
          DefinitionQuery = new DefinitionQuery(whereClause: "LAND_USE = 3", name: "Landuse")
        };
        var table4 = StandaloneTableFactory.Instance.CreateStandaloneTable(table_params, container);
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also