AnsweredAssumed Answered

Script tool to run on a web feature layer (hosted) from my portal ?

Question asked by nadav_gii on Oct 7, 2019


I have a script tool that takes a feature layer and update the table with 

'arcpy.da.UpdateCursor(path, fields_rec) as cursor:'

It runs on shp files from my geodatabase but i want to make it run also on a web feature layer that i upload from the organization portal, is it possible ?.

I am new to the AGOL field and possibilities. 
Here is the code for refernce:

import arcpy
import os
import time

arcpy.env.overwriteOutput = True
arcpy.env.workspace = r"C:\GIS\###\x_prebuild.gdb"

# Choose receivers layer and input lists for surveyour and restored status
rec_table = arcpy.GetParameterAsText(0)
surv_list_str = arcpy.GetParameterAsText(1)
Feature_rec = os.path.basename(rec_table)

surv_list = surv_list_str.split(",")
fields_rec = ["LineNumber", "Station", "Status", "Surv_Date","Restored_Date"]

# Update Status for Rec layer - SURVEYED
for x in range(int(len(surv_list)/3)):
    with arcpy.da.UpdateCursor(path, fields_rec) as cursor:
        for row in cursor:
            if row[0] == surv_list[i] and row[1] >= int(surv_list[i+1]) and row[1] <= int(surv_list[i+2]):
                row[2] = 1
                row[3] = time.strftime("%d/%m/%Y")
    i += 3