I just wondered: is there a limitation on the number of views you can create on a Hosted Feature Layer? In ArcGIS Online and/or in Portal for ArcGIS?
On this page (Create hosted feature layer views—Portal for ArcGIS | ArcGIS Enterprise) it is stated that
You can create a maximum of 20 views from the same hosted feature layer.
whereas on this page (Create hosted feature layer views—ArcGIS Online Help | ArcGIS) this limitation seems absent (although there is a limit of 20 to the number of categories you can assign to the item....)
And this limitation of 20 views on a Hosted Feature Layer in Portal for ArcGIS Enterprise, is that just a limitation of the UI which can be circumvented using a Python script, as kimberly peter states on GitHub (Add information and a sample for creating hosted feature layer views using Python · Issue #340 · Esri/arcgis-python-api … )?
With the Python script below I can create 25 views on a Hosted Feature Layer in ArcGIS Online. Would a similar approach be possible in Portal for ArcGIS Enterprise?
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
from provide_credentials import provide_credentials
username, password = provide_credentials()
my_agol = GIS("https://www.arcgis.com", username, password)
service = my_agol.content.get("<serviceItemId_of_your_Hosted_Feature_Layer>")
flc = FeatureLayerCollection.fromitem(service)
clients = ['ONE','TWO','THREE','FOUR','FIVE','SIX',
for client in clients:
view_name = service.name + "_View_" + client
view = flc.manager.create_view(name=view_name, spatial_reference=None, extent=None, allow_schema_changes=True, updateable=True, capabilities='Query, Update', view_layers=None)
for lyr in view.layers:
query = "Description = '%s'"%(client)