<?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 Re: AGOL Notebook webtool parameters in ArcGIS Notebooks Questions</title>
    <link>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1522173#M885</link>
    <description>&lt;P&gt;My variable is added to the notebook:&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;data_csv = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; "dataType": "GPDataFile",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; "paramName": "data_csv",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; &amp;nbsp; "value": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; &amp;nbsp; "url": ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And right now I am just using this itemid hardcoded to access and download the file to put in a pandas dataframe. What I would like is something like "data_csv.value.itemid" or something similar instead of the hardcoded itemid value.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;item_id = '38f3XXXXXXXX...'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;item = gis.content.get(item_id)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;csv_data = item.download(file_name='data.csv')&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;# Load the CSV into a Pandas DataFrame&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;with open(csv_data, 'r') as file:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; data_pd = pd.read_csv(file)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; print(data_pd.head())&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2024 13:02:01 GMT</pubDate>
    <dc:creator>HaydnLawrenceMoncton</dc:creator>
    <dc:date>2024-08-15T13:02:01Z</dc:date>
    <item>
      <title>AGOL Notebook webtool parameters</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1521752#M883</link>
      <description>&lt;P&gt;I am trying to get the item id from a "File" input parameter in my AGOL notebook's published webtool. The CSV is brought in no problem as I can access it, get the data, and output a new CSV. However, I have manually added the itemID to my code and would rather be able to access it from the input parameter of the chosen CSV.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know it's probably a quick answer, but can't find it in the documentation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if anyone knows how to send output to the final results window of a webtool in AGOL similar to how arcpy.AddMessage does for a normal geoprocessing tool, that would be great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My variable is added to the notebook:&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;data_csv = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; "dataType": "GPDataFile",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; "paramName": "data_csv",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; &amp;nbsp; "value": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; &amp;nbsp; "url": ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And right now I am just using this itemid hardcoded to access and download the file to put in a pandas dataframe. What I would like is something like "data_csv.value.itemid" or something similar instead of the hardcoded itemid value.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;item_id = '38f3XXXXXXXX...'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;item = gis.content.get(item_id)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;csv_data = item.download(file_name='data.csv')&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;# Load the CSV into a Pandas DataFrame&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;with open(csv_data, 'r') as file:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; data_pd = pd.read_csv(file)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; print(data_pd.head())&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 17:11:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1521752#M883</guid>
      <dc:creator>HaydnLawrenceMoncton</dc:creator>
      <dc:date>2024-08-15T17:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Notebook webtool parameters</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1522163#M884</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/700188"&gt;@HaydnLawrenceMoncton&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Any chance you could share some of the code for troubleshooting?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 12:33:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1522163#M884</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-08-15T12:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Notebook webtool parameters</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1522173#M885</link>
      <description>&lt;P&gt;My variable is added to the notebook:&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;data_csv = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; "dataType": "GPDataFile",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; "paramName": "data_csv",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; &amp;nbsp; "value": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; &amp;nbsp; "url": ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And right now I am just using this itemid hardcoded to access and download the file to put in a pandas dataframe. What I would like is something like "data_csv.value.itemid" or something similar instead of the hardcoded itemid value.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;item_id = '38f3XXXXXXXX...'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;item = gis.content.get(item_id)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;csv_data = item.download(file_name='data.csv')&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;# Load the CSV into a Pandas DataFrame&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;with open(csv_data, 'r') as file:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; data_pd = pd.read_csv(file)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; print(data_pd.head())&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 13:02:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1522173#M885</guid>
      <dc:creator>HaydnLawrenceMoncton</dc:creator>
      <dc:date>2024-08-15T13:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Notebook webtool parameters</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1524953#M886</link>
      <description>&lt;P&gt;I also could not get the WebTool to take a CSV item as input or a url to a CSV file and directly access the item/csv data from the input parameter.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 07:04:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1524953#M886</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-08-21T07:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: AGOL Notebook webtool parameters</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1603013#M915</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/700188"&gt;@HaydnLawrenceMoncton&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the questions!&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Notebook web tools currently do not have an equivalent to arcpy.AddMessage(), but I have noted that this feature will be desired. For the time being, the closest alternative is to create a string output parameter that includes the messages you would like to pass on to the web tool users.&lt;/LI&gt;&lt;LI&gt;To input an item ID to a web tool, you can create a string input parameter to obtain the item ID from the web tool users. Then, you can include logic to validate the item and proceed to the next steps. For example:&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="python"&gt;input_csv_item_id = "&amp;lt;item-id-from-user&amp;gt;" # input parameter

from arcgis.gis import GIS
gis = GIS("home")

input_item = gis.content.get(input_csv_item_id)

if not input_item:
    raise Exception(f"Unable to find an item matching the input ID '{input_csv_item_id}'.")
elif input_item.type != "CSV":
    raise Exception(f"The input ID '{input_csv_item_id}' does not refer to a CSV item.")​

csv_data = input_item.download(file_name="data.csv")
with open(csv_data, "r") as file:
  data_pd = pd.read_csv(file)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lingtao&lt;/P&gt;&lt;P&gt;Product Engineer for ArcGIS Notebooks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Apr 2025 23:14:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/agol-notebook-webtool-parameters/m-p/1603013#M915</guid>
      <dc:creator>xlt208</dc:creator>
      <dc:date>2025-04-04T23:14:25Z</dc:date>
    </item>
  </channel>
</rss>

