<?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 Unable to save standalone table to .lyrx using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163297#M64324</link>
    <description>&lt;P&gt;I am trying to automate packaging of layer and other files to a .zip for sharing. This works fine for layers in the map using&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;arcpy.management.SaveLayerToFile()&lt;/FONT&gt;,&lt;/FONT&gt;However this does not work when passing a table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Outside of Python I can right click on a standalone table in the content pane, and use Sharing &amp;gt; Save As Layer File. This works as expected and creates a .lyrx with the standalone table. Can I replicate this function using Python?&lt;/P&gt;&lt;P&gt;As an example I have attempted the following which returns the error 'The value is not a layer'&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;import arcpy&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;project = arcpy.mp.ArcGISProject(&amp;lt;path to project&amp;gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;map = project.listMaps()[0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;table = map.listTables()[0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;arcpy.management.SaveToLayerFile(table,&amp;lt;path to lyrx&amp;gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is there another function to save a table to a lyrx? or can I reference the table in another way so that &lt;FONT face="courier new,courier" size="2"&gt;.SaveToLayerFile&lt;/FONT&gt; will accept it?&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 22:07:40 GMT</pubDate>
    <dc:creator>NathanEmerson</dc:creator>
    <dc:date>2022-04-11T22:07:40Z</dc:date>
    <item>
      <title>Unable to save standalone table to .lyrx using python</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163297#M64324</link>
      <description>&lt;P&gt;I am trying to automate packaging of layer and other files to a .zip for sharing. This works fine for layers in the map using&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;arcpy.management.SaveLayerToFile()&lt;/FONT&gt;,&lt;/FONT&gt;However this does not work when passing a table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Outside of Python I can right click on a standalone table in the content pane, and use Sharing &amp;gt; Save As Layer File. This works as expected and creates a .lyrx with the standalone table. Can I replicate this function using Python?&lt;/P&gt;&lt;P&gt;As an example I have attempted the following which returns the error 'The value is not a layer'&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;import arcpy&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;project = arcpy.mp.ArcGISProject(&amp;lt;path to project&amp;gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;map = project.listMaps()[0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;table = map.listTables()[0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;arcpy.management.SaveToLayerFile(table,&amp;lt;path to lyrx&amp;gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is there another function to save a table to a lyrx? or can I reference the table in another way so that &lt;FONT face="courier new,courier" size="2"&gt;.SaveToLayerFile&lt;/FONT&gt; will accept it?&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 22:07:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163297#M64324</guid>
      <dc:creator>NathanEmerson</dc:creator>
      <dc:date>2022-04-11T22:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to save standalone table to .lyrx using python</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163307#M64325</link>
      <description>&lt;P&gt;Was there a chance that your table was associated with a featureclass in the past?&lt;/P&gt;&lt;P&gt;There is no mention of pure tables in the documentation.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/save-to-layer-file.htm" target="_blank"&gt;Save To Layer File (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 22:55:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163307#M64325</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-04-11T22:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to save standalone table to .lyrx using python</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163312#M64326</link>
      <description>&lt;P&gt;No, these tables are pure data related to features across multiple feature classes by a common id, no joins or relationships have previously or currently exist.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 23:28:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163312#M64326</guid>
      <dc:creator>NathanEmerson</dc:creator>
      <dc:date>2022-04-11T23:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to save standalone table to .lyrx using python</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163315#M64327</link>
      <description>&lt;P&gt;It does work, as you indicated.... I wasn't expecting this ( I usually share a project package).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect you have to check in the CIM class for specifics for keywords and potential code possibilities.&lt;/P&gt;&lt;P&gt;Open the *.lyrx in notepad++ and you can check the contents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{
  "type" : "CIMLayerDocument",
  "version" : "2.9.0",
  "build" : 32739,
  "tables" : [
    "CIMPATH=birdondog/spyder.xml"
  ],
  "tableDefinitions" : [
    {
      "type" : "CIMStandaloneTable",
      "name" : "Spyder",
      "uRI" : "CIMPATH=birdondog/spyder.xml",
      "sourceModifiedTime" : {
        "type" : "TimeInstant"
      },
      "useSourceMetadata" : true,
      "displayField" : "Spyder_required",
      "editable" : true,
      "dataConnection" : {
        "type" : "CIMStandardDataConnection",
        "workspaceConnectionString" : "DATABASE=..\\Arc_projects\\Test_29\\Test_29.gdb",
        "workspaceFactory" : "FileGDB",
        "dataset" : "Spyder",
        "datasetType" : "esriDTTable"
      },
      "autoGenerateRowTemplates" : true,
      "serviceTableID" : -1,
      "showPopups" : true
    }
  ],
  "rGBColorProfile" : "sRGB IEC61966-2.1",
  "cMYKColorProfile" : "U.S. Web Coated (SWOP) v2"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, it doesn't contain the data, just a reference to the location of the table (line 21) and the map frame where the standalone table was located.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 00:38:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163315#M64327</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-04-12T00:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to save standalone table to .lyrx using python</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163333#M64328</link>
      <description>&lt;P&gt;Thanks for the details, I am only after a reference to the tables. I will look at the details and see if I can work something out. Cheers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 02:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-save-standalone-table-to-lyrx-using/m-p/1163333#M64328</guid>
      <dc:creator>NathanEmerson</dc:creator>
      <dc:date>2022-04-12T02:31:09Z</dc:date>
    </item>
  </channel>
</rss>

