Hello! Im new to PythonAPI, still very much a novice. I'm trying to update some fields in an AGO feature layer from a script. Hopefully I will be able to set up a reoccurring task which will update the layer consistently. Every time the task will run I want my script to look at a field, and change another field based on what is there.
The change will occur based on a FromDate and a ToDate field. These fields will be the cause of the edit, which will change a field from Vacant to Occupied, depending if the current time (now()) falls within the FromDate / ToDate times. In other words, When the current time is After the FromDate and before the ToDate, the field will be occupied.
This is what I have so far:
from arcgis.gis import GIS
from arcgis.features import FeatureSet, Feature
gis = GIS(url='https://pythonapi.playground.esri.com/portal', username='XXXXXX', password='XXXXXX')
itemId = 'xxxxxxxxxxxxxxxxxx'
#this is where I get confused
features = not sure what to put here
for feature in features:
if FromDate <= Now() and ToDate >= Now():
newValue = 'occupied'
newValue2 = 'vacant'
# update the features in AGOL
results = fl.edit_features(updates=features)
Again, super new to this so any advice would be appreciated! Thanks.