<?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: Quick Method to Create Views for Multiple Features (one view per feature) in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1129532#M43563</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/240286"&gt;@Kanin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for pointing me in the right direction. Here's the code snippet that I used:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
from arcgis.mapping import WebMap

gis = GIS("&amp;lt;portal&amp;gt;", "user","pw")

fl_wm_search = gis.content.get("web_map_item_id")
fl_wm_object = WebMap(fl_wm_search)

fl_layers = {item.itemId for item in fl_wm_object.layers}
update_dict = {"viewDefinitionQuery" : "field1 = ''"}

for f in fl_layers:
    source_search = gis.content.search(f)[0]
    source_flc = FeatureLayerCollection.fromitem(source_search)
    new_view = source_flc.manager.create_view(name="{}_Null".format(source_search.title.replace(" ","_")))
    view_search = gis.content.search(new_view.title)[0]
    view_flc = FeatureLayerCollection.fromitem(view_search)
    service_layer = view_flc.layers
    for i in range (len(service_layer)):
        service_layer[i].manager.update_definition(update_dict)
    view_search.move("Home Folder")&lt;/LI-CODE&gt;&lt;P&gt;Happy New Years!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
    <pubDate>Wed, 29 Dec 2021 19:50:30 GMT</pubDate>
    <dc:creator>wcozzens</dc:creator>
    <dc:date>2021-12-29T19:50:30Z</dc:date>
    <item>
      <title>Quick Method to Create Views for Multiple Features (one view per feature)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1128177#M43489</link>
      <description>&lt;P&gt;I have a web map with roughly 50 features and counting. I'm looking for a quick and dirty way to create a view of each layer where a given field is null. The good news is that this field exists in each of the 50 features.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy way to do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 22:24:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1128177#M43489</guid>
      <dc:creator>wcozzens</dc:creator>
      <dc:date>2021-12-21T22:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Method to Create Views for Multiple Features (one view per feature)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1128244#M43490</link>
      <description>&lt;P&gt;You can try using ArcGIS API for Python to automate view creation. This can be done via ArcGIS Notebooks in ArcGIS Online or ArcGIS Pro. Please see more steps at the links:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://support.esri.com/en/technical-article/000020083" target="_blank"&gt;How To: Create a view from a hosted feature layer and define the view using ArcGIS API for Python (esri.com)&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-blog/using-the-arcgis-api-for-python-to-create-a-view/ba-p/902966" target="_blank"&gt;Using the ArcGIS API for Python to create a view f... - Esri Community&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Kanin&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#999999"&gt;&lt;EM&gt;If this answer solved your question, please mark it as "Accept as Solution" to help others who have the same question.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 06:53:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1128244#M43490</guid>
      <dc:creator>Kanin</dc:creator>
      <dc:date>2021-12-22T06:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Method to Create Views for Multiple Features (one view per feature)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1129532#M43563</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/240286"&gt;@Kanin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for pointing me in the right direction. Here's the code snippet that I used:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
from arcgis.mapping import WebMap

gis = GIS("&amp;lt;portal&amp;gt;", "user","pw")

fl_wm_search = gis.content.get("web_map_item_id")
fl_wm_object = WebMap(fl_wm_search)

fl_layers = {item.itemId for item in fl_wm_object.layers}
update_dict = {"viewDefinitionQuery" : "field1 = ''"}

for f in fl_layers:
    source_search = gis.content.search(f)[0]
    source_flc = FeatureLayerCollection.fromitem(source_search)
    new_view = source_flc.manager.create_view(name="{}_Null".format(source_search.title.replace(" ","_")))
    view_search = gis.content.search(new_view.title)[0]
    view_flc = FeatureLayerCollection.fromitem(view_search)
    service_layer = view_flc.layers
    for i in range (len(service_layer)):
        service_layer[i].manager.update_definition(update_dict)
    view_search.move("Home Folder")&lt;/LI-CODE&gt;&lt;P&gt;Happy New Years!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Wed, 29 Dec 2021 19:50:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1129532#M43563</guid>
      <dc:creator>wcozzens</dc:creator>
      <dc:date>2021-12-29T19:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Method to Create Views for Multiple Features (one view per feature)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1129600#M43567</link>
      <description>&lt;P&gt;Hello Mike,&lt;/P&gt;&lt;P&gt;Glad this works for you. Happy New Years to you too!&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Kanin&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 01:28:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1129600#M43567</guid>
      <dc:creator>Kanin</dc:creator>
      <dc:date>2021-12-30T01:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Method to Create Views for Multiple Features (one view per feature)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1325619#M54379</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;When creating the view how do, I make the script update the query for more than one layer.&amp;nbsp; My Feature class has about 55 layers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;using this the line below will update the first sub layer and not the other one's that is in my feature class&lt;/P&gt;&lt;P&gt;service_layer = view_flc.layers[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;ramon&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 20:34:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/quick-method-to-create-views-for-multiple-features/m-p/1325619#M54379</guid>
      <dc:creator>RamonWilliams</dc:creator>
      <dc:date>2023-09-05T20:34:59Z</dc:date>
    </item>
  </channel>
</rss>

