Is there any way to share a tool from ArcGIS Pro as a web/geoprocessing tool without having a dataset loaded in by default?

535
1
Jump to solution
07-24-2019 10:50 AM
AaronLaver
New Contributor II

Hi all,

I recently created a "Geodatabase append" tool which, in a nutshell, batch process-appends all feature classes within a specified input geodatabase to a target "master" geodatabase, plus some optional functionality which deletes fields within the Master GDB prior to the append. The tool works great in ArcGIS pro, but I'm seeking a way to publish ONLY the tool to portal (not the dataset or reference to the dataset represented in the geoprocessing history). I've tried only uploading the schema, I've tried setting self.params.value to empty all parameters upon initialization, and nothing seems to work. 

Has anyone been able to successfully do this? In general, validation has been very tricky for me to get a handle on... but my code can be found below. If there's a general process answer or a script-based answer, I'd be open to both. 

I realize this might sound like a cryptic question to some, so if I need to elaborate I'd be happy to. I'm hoping that I'm just a big dummy that overlooked something in my process to reach the desired result... but I digress. My validation code can be found below, if it helps. Thanks in advance for any help!

Here's what I want to happen on load: 

Here's what happens when I open the Published version: 

Or when I open the Schema Only Published version: 

Validation Code:

import arcpy

class ToolValidator(object):
    """Class for validating a tool's parameter values and controlling
    the behavior of the tool's dialog."""

    def __init__(self):
        """Setup arcpy and the list of tool parameters.""" 
        self.params = arcpy.GetParameterInfo()


    def initializeParameters(self): 
        """Refine the properties of a tool's parameters. This method is 
        called when the tool is opened."""
        # Thought I had to throw this in the the published version to clear fields, but 
        # this didn't work to clear either
        self.params[0].value = ""
        self.params[1].value = ""
        self.params[2].value = ""
        self.params[3].value = ""

    def updateParameters(self):
        """Modify the values and properties of parameters before internal
        validation is performed. This method is called whenever a parameter
        has been changed."""

        # Lots of syntax not related to this post

        # A "hide" function which works only in the original script tool, not the 
        # published versions
        if self.params[2].value:
            self.params[3].enabled = True
        else:
            self.params[3].enabled = False  

    def updateMessages(self):
        """Modify the messages created by internal validation for each tool
        parameter. This method is called after internal validation."""

        
        ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
1 Solution

Accepted Solutions
AaronLaver
New Contributor II

Thank goodness, I was able to remedy this problem (kind of) fairly easily once I dug around the geoprocessing package for a long while. After you add the downloaded geoprocessing package to your project, a folder is created that contains around 5 versions of your toolbox at about 3 different folder levels. The default path to find the one I wanted to use (with blank parameters and full validation functionality on load), for me, was something along the lines of

C:\Users\*USER NAME*\Documents\ArcGIS\Packages\*NAME OF TOOL FOLLOWED BY A BUNCH OF CHARACTERS*\p12\*Folder name of original script*\*NAME OF TOOLBOX*.

I included this default link schema within a "Read Me" file to direct the new users to it when adding the toolbox. Had a colleague go through the read me file and add the link, and it worked like a charm. Annoying, but it's a way to get it to work the way I needed it to. Note that if you don't want people to access your source code, you need to be sure to password protect it. 

View solution in original post

0 Kudos
1 Reply
AaronLaver
New Contributor II

Thank goodness, I was able to remedy this problem (kind of) fairly easily once I dug around the geoprocessing package for a long while. After you add the downloaded geoprocessing package to your project, a folder is created that contains around 5 versions of your toolbox at about 3 different folder levels. The default path to find the one I wanted to use (with blank parameters and full validation functionality on load), for me, was something along the lines of

C:\Users\*USER NAME*\Documents\ArcGIS\Packages\*NAME OF TOOL FOLLOWED BY A BUNCH OF CHARACTERS*\p12\*Folder name of original script*\*NAME OF TOOLBOX*.

I included this default link schema within a "Read Me" file to direct the new users to it when adding the toolbox. Had a colleague go through the read me file and add the link, and it worked like a charm. Annoying, but it's a way to get it to work the way I needed it to. Note that if you don't want people to access your source code, you need to be sure to password protect it. 

0 Kudos