Select to view content in your preferred language

Using output from script tool as input to common tools

666
5
Jump to solution
08-15-2023 09:48 AM
Labels (3)
AngelaStrongarm
New Contributor II

Part of a model I am building uses a tool that I scripted (which is supposed to be a simple export feature class from sde connection to a local gdb for processing) and I'd like to use the output featureclass from that tool as the input to the next common tool in the model. I have read at least a dozen solutions to this same problem from other folks on here over and over but I can not seem to apply the solutions to my specific instance. I am NOT a programmer so this script was thrown together also using examples from around the community. 

Here is the piece of the model that I need to connect- 

AngelaStrongarm_0-1692117327167.png

with ConnectandExport being the scripted tool (which works as a standalone script) *I cut off the sde connection parameters in the screenshot but they are valid and the connection succeeds every time)*

AngelaStrongarm_1-1692117485976.png

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ShitijMehta
Esri Regular Contributor

you need to add an output (direction) parameter and Set() it to the output that you are creating in the script.

 

View solution in original post

0 Kudos
5 Replies
DavidSolari
Occasional Contributor III

If you add a script tool to a model it should show up as a rectangle, just like the normal tools. Your screenshot is highlighting a variable, try dragging the script tool from the catalog into the ModelBuilder canvas and see if that gives you a more sensible item to work with.

0 Kudos
AngelaStrongarm
New Contributor II

Thank you for this - seems like an obvious thing that I skipped over, but then how do I call the exported FC from that tool? For ex: 

AngelaStrongarm_0-1692128079101.png

I want to use the export from this tool as the input for the next tool.

0 Kudos
DavidSolari
Occasional Contributor III

What do your tool parameters look like when you defined the tool in Pro? Your script has 2 inputs and 1 output, these same inputs and outputs must be defined in the tool's structure. The docs can explain this better than I can: link.

In your case I think you can eliminate both inputs as everything is hardcoded into the script, or you can turn some of the inputs into parameters to make your tool more flexible, up to you. The output parameter will have to be a Derived Output as you're creating the feature class wholly within the script, if this causes issues you can let the user pick the output FC as a Required Output parameter instead.

ShitijMehta
Esri Regular Contributor

you need to add an output (direction) parameter and Set() it to the output that you are creating in the script.

 

0 Kudos
ShitijMehta
Esri Regular Contributor

What is the data type of the ConnectedEx or the output that you are trying to connect to the make feature layer tool?

0 Kudos