<?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 Script tool to run on a web feature layer (hosted) from my portal ? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/script-tool-to-run-on-a-web-feature-layer-hosted/m-p/658502#M29211</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a script tool that takes a feature layer and update the table with&amp;nbsp;&lt;/P&gt;&lt;P&gt;'arcpy.da.UpdateCursor(path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;fields_rec) &lt;SPAN style="color: #cc7832;"&gt;as &lt;/SPAN&gt;cursor:'&lt;/P&gt;&lt;P&gt;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 ?.&lt;/P&gt;&lt;P&gt;I am new to the AGOL field and possibilities.&amp;nbsp;&lt;BR /&gt;Here is the code for refernce:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;arcpy
&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;os
&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;time

arcpy.env.overwriteOutput = &lt;SPAN style="color: #cc7832;"&gt;True
&lt;/SPAN&gt;arcpy.env.workspace = &lt;SPAN style="color: #6a8759;"&gt;r"C:\GIS\###\x_prebuild.gdb"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Choose receivers layer and input lists for surveyour and restored status
&lt;/SPAN&gt;rec_table = arcpy.GetParameterAsText(&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;)
surv_list_str = arcpy.GetParameterAsText(&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;Feature_rec = os.path.basename(rec_table)&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;surv_list = surv_list_str.split(&lt;SPAN style="color: #6a8759;"&gt;","&lt;/SPAN&gt;)
fields_rec = [&lt;SPAN style="color: #6a8759;"&gt;"LineNumber"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Station"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Status"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Surv_Date"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Restored_Date"&lt;/SPAN&gt;]&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Update Status for Rec layer - SURVEYED
&lt;/SPAN&gt;i=&lt;SPAN style="color: #6897bb;"&gt;0
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;x &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;&lt;SPAN style="color: #8888c6;"&gt;range&lt;/SPAN&gt;(&lt;SPAN style="color: #8888c6;"&gt;int&lt;/SPAN&gt;(&lt;SPAN style="color: #8888c6;"&gt;len&lt;/SPAN&gt;(surv_list)/&lt;SPAN style="color: #6897bb;"&gt;3&lt;/SPAN&gt;)):
    &lt;SPAN style="color: #cc7832;"&gt;with &lt;/SPAN&gt;arcpy.da.UpdateCursor(path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;fields_rec) &lt;SPAN style="color: #cc7832;"&gt;as &lt;/SPAN&gt;cursor:
        &lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;row &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;cursor:
            &lt;SPAN style="color: #cc7832;"&gt;if &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;] == surv_list&lt;I&gt; &lt;SPAN style="color: #cc7832;"&gt;and &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;] &amp;gt;= &lt;SPAN style="color: #8888c6;"&gt;int&lt;/SPAN&gt;(surv_list[i+&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;]) &lt;SPAN style="color: #cc7832;"&gt;and &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;] &amp;lt;= &lt;SPAN style="color: #8888c6;"&gt;int&lt;/SPAN&gt;(surv_list[i+&lt;SPAN style="color: #6897bb;"&gt;2&lt;/SPAN&gt;]):
                row[&lt;SPAN style="color: #6897bb;"&gt;2&lt;/SPAN&gt;] = &lt;SPAN style="color: #6897bb;"&gt;1
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;                &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;3&lt;/SPAN&gt;] = time.strftime(&lt;SPAN style="color: #6a8759;"&gt;"%d/%m/%Y"&lt;/SPAN&gt;)
            cursor.updateRow(row)
    i += &lt;SPAN style="color: #6897bb;"&gt;3&lt;/SPAN&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:51:58 GMT</pubDate>
    <dc:creator>NadavBronshtein</dc:creator>
    <dc:date>2021-12-12T03:51:58Z</dc:date>
    <item>
      <title>Script tool to run on a web feature layer (hosted) from my portal ?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/script-tool-to-run-on-a-web-feature-layer-hosted/m-p/658502#M29211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a script tool that takes a feature layer and update the table with&amp;nbsp;&lt;/P&gt;&lt;P&gt;'arcpy.da.UpdateCursor(path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;fields_rec) &lt;SPAN style="color: #cc7832;"&gt;as &lt;/SPAN&gt;cursor:'&lt;/P&gt;&lt;P&gt;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 ?.&lt;/P&gt;&lt;P&gt;I am new to the AGOL field and possibilities.&amp;nbsp;&lt;BR /&gt;Here is the code for refernce:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;arcpy
&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;os
&lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;time

arcpy.env.overwriteOutput = &lt;SPAN style="color: #cc7832;"&gt;True
&lt;/SPAN&gt;arcpy.env.workspace = &lt;SPAN style="color: #6a8759;"&gt;r"C:\GIS\###\x_prebuild.gdb"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Choose receivers layer and input lists for surveyour and restored status
&lt;/SPAN&gt;rec_table = arcpy.GetParameterAsText(&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;)
surv_list_str = arcpy.GetParameterAsText(&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;)
&lt;SPAN style="color: #808080;"&gt;Feature_rec = os.path.basename(rec_table)&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;surv_list = surv_list_str.split(&lt;SPAN style="color: #6a8759;"&gt;","&lt;/SPAN&gt;)
fields_rec = [&lt;SPAN style="color: #6a8759;"&gt;"LineNumber"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Station"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Status"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Surv_Date"&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;"Restored_Date"&lt;/SPAN&gt;]&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Update Status for Rec layer - SURVEYED
&lt;/SPAN&gt;i=&lt;SPAN style="color: #6897bb;"&gt;0
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;x &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;&lt;SPAN style="color: #8888c6;"&gt;range&lt;/SPAN&gt;(&lt;SPAN style="color: #8888c6;"&gt;int&lt;/SPAN&gt;(&lt;SPAN style="color: #8888c6;"&gt;len&lt;/SPAN&gt;(surv_list)/&lt;SPAN style="color: #6897bb;"&gt;3&lt;/SPAN&gt;)):
    &lt;SPAN style="color: #cc7832;"&gt;with &lt;/SPAN&gt;arcpy.da.UpdateCursor(path&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;fields_rec) &lt;SPAN style="color: #cc7832;"&gt;as &lt;/SPAN&gt;cursor:
        &lt;SPAN style="color: #cc7832;"&gt;for &lt;/SPAN&gt;row &lt;SPAN style="color: #cc7832;"&gt;in &lt;/SPAN&gt;cursor:
            &lt;SPAN style="color: #cc7832;"&gt;if &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;] == surv_list&lt;I&gt; &lt;SPAN style="color: #cc7832;"&gt;and &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;] &amp;gt;= &lt;SPAN style="color: #8888c6;"&gt;int&lt;/SPAN&gt;(surv_list[i+&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;]) &lt;SPAN style="color: #cc7832;"&gt;and &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;] &amp;lt;= &lt;SPAN style="color: #8888c6;"&gt;int&lt;/SPAN&gt;(surv_list[i+&lt;SPAN style="color: #6897bb;"&gt;2&lt;/SPAN&gt;]):
                row[&lt;SPAN style="color: #6897bb;"&gt;2&lt;/SPAN&gt;] = &lt;SPAN style="color: #6897bb;"&gt;1
&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;                &lt;/SPAN&gt;row[&lt;SPAN style="color: #6897bb;"&gt;3&lt;/SPAN&gt;] = time.strftime(&lt;SPAN style="color: #6a8759;"&gt;"%d/%m/%Y"&lt;/SPAN&gt;)
            cursor.updateRow(row)
    i += &lt;SPAN style="color: #6897bb;"&gt;3&lt;/SPAN&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:51:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/script-tool-to-run-on-a-web-feature-layer-hosted/m-p/658502#M29211</guid>
      <dc:creator>NadavBronshtein</dc:creator>
      <dc:date>2021-12-12T03:51:58Z</dc:date>
    </item>
  </channel>
</rss>

