Select to view content in your preferred language

File Output Paramter in WebTool that was published from a Notebook in ArcGIS Online

78
3
yesterday
Sven_Harpering
Esri Contributor

Hello everyone,

we have created a notebook in ArcGIS Online that creates a Word document based on various parameters. If we let the notebook run on its own, everything works. The output is written to the "arcgis/home" directory.

The next step would be to publish the notebook as a web tool in ArcGIS Online. To do this, we wanted to define an output parameter. The settings currently look like this:

Sven_Harpering_0-1721663506679.png

 

A first question would be what we have to specify as a default value in JSON format. According to the documentation, it has to be a URL to an existing output? Currently, we have simply uploaded the Word template as an item in ArcGIS Online and specified the URL to it.

Afterwards we added this snippet at the end of the notebook:

Sven_Harpering_1-1721663506683.png

 

The name of the variable equals the output variable name for the word file.

After publishing, we open the tool in map viewer and want to run it. Here we immediately notice that the output parameter does not appear in the GUI.

Sven_Harpering_2-1721663507188.png

 

The tool can still be started, but aborts with an error message in the output parameter area. 

Sven_Harpering_3-1721663506701.png

 

It seems that the error is in the output parameter section. Do you have any clue, what we are doing wrong in the whole output parameter section (Notebook config, etc.)? The input parameters work.

Best

Sven

 

Passionate about GIS and on the journey as an instructor for analytical insights.
0 Kudos
3 Replies
xlt208
by Esri Contributor
Esri Contributor

Hi @Sven_Harpering

Thanks for reaching out!

  1. For the default value, if there is a URL pointing to a file that you want to default to, you can specify the default value as {"url": "<url-to-file>"}. Alternatively, since it is okay to leave the URL blank, you can specify the value like this: {"url": ""}.
  2. It is expected that the output parameters will not appear in the GUI before you run the tool. If you expect a value from the web tool users, please create an input parameter for it. Output parameters are what the notebook web tool will output after the tool finishes running and cannot be specified by the users.
  3. Since the file ends up being a Microsoft Word item in the content, have you considered outputting it as a string instead of a file, with the string value pointing to the URL of the item's details page? That way, users can go to the item details page and proceed with sharing, downloading, or updating the item. 
  4. Could you please copy the error message in the last screenshot and paste it as text here? We are unable to read the error message very clearly. (The screenshot might have been compressed by the website when it was uploaded.)

Looking forward to hearing back from you!

 

Lingtao

Product Engineer for ArcGIS Notebooks

 

BenGiese
New Contributor II

Hi @xlt208 ,

I'm working with Sven on this project. Thanks for your guidance; it has already helped us a lot.

We are currently keeping {"url": ""} empty and have defined an input where the user can specify the output name. The .docx files are published as items in ArcGIS Online at the end. Our script creates a .docx file for each feature.

You asked for the error message. I don’t have access to it anymore because my script is working now. I think it was a problem with the specification of the output parameters and the URL we were pointing towards.

We want the user to select a feature on a map in the last step. The reports should then be created only for the selected features. This is possible in Experience Builder.

 

BenGiese_1-1721728746492.png

 

Apparently, the problem is that the selected features are not being passed along. Our input parameter is a feature set, but we still need to convert it to a feature set in the script. The selected features are being lost in the input. Do you have any idea what we need to set up to ensure the selection is considered?

This is our setting for the input features paramter:

BenGiese_2-1721728752264.png

This is the Code: 

 

selected_damage = {
	"url": "https://services3.arcgis.com/JhD3NyxTJcNiae8J/arcgis/rest/services/survey123_25027c5ec6294a65a7a851be8740f6f8_results/FeatureServer/0"
}

#get the url and return a feature layer
feature_layer_url = selected_damage["url"]
feature_layer = FeatureLayer(feature_layer_url)

# Get the Feature set
feature_set = feature_layer.query(where="1=1")  # Abfrage mit allen Features

 

Until now this only returns a feature set with all features of the feature layer, not the selected. 

 

0 Kudos
Sven_Harpering
Esri Contributor

Hi @xlt208@BenGiese,

here is the error message:

Sven_Harpering_0-1721732328078.png

As Ben wrote, we have updatet the script already, so we are not using the output parameter any longer. But maybe it is still interesting for you.

 

Best

Sven

 

Passionate about GIS and on the journey as an instructor for analytical insights.
0 Kudos