Hello,
I am trying to se the ArcGIS API for Python to create a "FormCollection" from a webmap. The webmap contains several FieldMap smartforms and all I want is to create a form collection as per ESRI's documentation. I have written the following code:
wmItem = gis.content.get(itemID) # Fetch webmap item
wm = WebMap(wmItem) # Create wm object
fcoll = wm.forms
The error is on line 3: "AttributeError: 'PropertyMap' instance has no attribute 'layerType':
This webmap has several layer and tables with smartforms. I have also tried several other web maps and keep getting the same error.
Alternatively, this following code, straight from ESRI documentation gives the exact same error on the form_collection variable:
from arcgis.mapping.forms import FormCollection wm = arcgis.mapping.WebMap(item) form_collection = FormCollection(wm)
I would greatly appreciate any help.
Thank you!
Hello @YS2388 , after a quick test it looks like the ArcGIS API for Python has a bug when there are tables in a map and you try to access the FormCollection.
Depending on what you are looking to accomplish you can iterate through the layers and tables in the map and access the form.
wmItem = gis.content.get(itemID) # Fetch webmap item
wm = WebMap(wmItem) # Create wm object
for layer in wm.layers:
if 'formInfo' in layer:
print(layer.formInfo)
for table in wm.tables:
if 'formInfo' in table:
print(table.formInfo)
Thanks for the reply Justin. It is helpful!
I would like to edit smartforms using the API and just could not figure out why I was getting the error. Is there a way to report this bug to ESRI?