<?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 check if layer or standalone table can be created from an Item in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/unable-to-check-if-layer-or-standalone-table-can/m-p/799467#M1926</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to add temporary layer or standalone table when user specifies&amp;nbsp;the path to a dataset. To accomplish this task I create an instance of the &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic9109.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Item&lt;/A&gt; via &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic9157.html" rel="nofollow noopener noreferrer" target="_blank"&gt;ItemFactory&lt;/A&gt;:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; item &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ItemFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Create&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ItemFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ItemType&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;PathItem&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And then I check if a layer or standalone table can be created from the item using corresponding methods of &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11794.html" rel="nofollow noopener noreferrer" target="_blank"&gt;LayerFactory&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12275.html" rel="nofollow noopener noreferrer" target="_blank"&gt;StandaloneTableFactory&lt;/A&gt;:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;LayerFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CanCreateLayerFrom&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; LayerFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CreateFeatureLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; MapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Active&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Map&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;StandaloneTableFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CanCreateStandaloneTableFrom&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; StandaloneTableFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CreateStandaloneTable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; MapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Active&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Map&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But both &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11799.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateLayerFrom&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12279.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateStandaloneTableFrom&lt;/A&gt; methods don't work properly. They always return true regardless of what the type an item of. If I create an item from a feature class, the &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12279.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateStandaloneTableFrom&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;returns true for this item. If I create an item from a table, the &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11799.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateLayerFrom&lt;/A&gt; returns true for the item. It is definitely wrong. With this behavior the code above works incorrectly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also both &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11802.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CreateFeatureLayer&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12281.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CreateStandaloneTable&lt;/A&gt; create an item in the TOC even if they return null.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please fix this issues. Also can you suggest a workaround while you are fixing the bugs?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:15:19 GMT</pubDate>
    <dc:creator>MaxMax2</dc:creator>
    <dc:date>2021-12-12T09:15:19Z</dc:date>
    <item>
      <title>Unable to check if layer or standalone table can be created from an Item</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/unable-to-check-if-layer-or-standalone-table-can/m-p/799467#M1926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to add temporary layer or standalone table when user specifies&amp;nbsp;the path to a dataset. To accomplish this task I create an instance of the &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic9109.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Item&lt;/A&gt; via &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic9157.html" rel="nofollow noopener noreferrer" target="_blank"&gt;ItemFactory&lt;/A&gt;:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; item &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ItemFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Create&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ItemFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ItemType&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;PathItem&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And then I check if a layer or standalone table can be created from the item using corresponding methods of &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11794.html" rel="nofollow noopener noreferrer" target="_blank"&gt;LayerFactory&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12275.html" rel="nofollow noopener noreferrer" target="_blank"&gt;StandaloneTableFactory&lt;/A&gt;:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;LayerFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CanCreateLayerFrom&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; LayerFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CreateFeatureLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; MapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Active&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Map&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;StandaloneTableFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CanCreateStandaloneTableFrom&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; StandaloneTableFactory&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Instance&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;CreateStandaloneTable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; MapView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Active&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Map&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But both &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11799.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateLayerFrom&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12279.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateStandaloneTableFrom&lt;/A&gt; methods don't work properly. They always return true regardless of what the type an item of. If I create an item from a feature class, the &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12279.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateStandaloneTableFrom&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;returns true for this item. If I create an item from a table, the &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11799.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CanCreateLayerFrom&lt;/A&gt; returns true for the item. It is definitely wrong. With this behavior the code above works incorrectly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also both &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic11802.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CreateFeatureLayer&lt;/A&gt; and &lt;A href="https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic12281.html" rel="nofollow noopener noreferrer" target="_blank"&gt;CreateStandaloneTable&lt;/A&gt; create an item in the TOC even if they return null.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please fix this issues. Also can you suggest a workaround while you are fixing the bugs?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:15:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/unable-to-check-if-layer-or-standalone-table-can/m-p/799467#M1926</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2021-12-12T09:15:19Z</dc:date>
    </item>
  </channel>
</rss>

