ArcPy and ArcMap – Calculating Fields from Layer Outputs Explained

arcmaparcpymodelbuilderparameterspython-script-tool

I'm working in Pycharm Python IDLE under ArcPy, to later work on setting up a toolbox in ArcGIS Desktop 10.7.

I have a large script running in Python that works fine without parameters. Now, I want to create a tool for ArcGIS Desktop 10.7, and have this problem configuring Script Properties. I can't make appear in the next window -'Parameter Properties' > 'Property' = 'Obtained From'-, tables or layers that has been calculated during my tool process, and become like intermediate variables.

I need to recalculate fields in several layers from intermediate data (i need one field from that data), but doesn't appears in the mentioned property like a value, only appears input layers that already get in my hard disk before running process. When I run my tool from ArcMap, in field calculator doesn't appear because, obviously the referenced layer still not processed. But same situation in ModelBuilder it's allowed or better preconfigured.

Do I need to edit my Python code, or is it a configuration problem from 'Script Properties' from ArcMap?

Pair of images, from my script tool, and same situation in ModelBuilder:

  1. My script tool, line blue, that three layers are inputs. Don't show any intermediate data.

enter image description here

  1. Here, what I need to get, those layers with blue symbol processing, but translated in Python and in the script tool

enter image description here

  1. Because in image 2 appears the info from previous layer (loaded fields)

enter image description here

Best Answer

When you wire up a script to a tool interface, the interface will have no knowledge of any layers created by the code itself, unless its an output parameter you have specified. As you are creating these layers in your code I would suggest you edit your code to utilise them as it is not possible to access something that does not yet exist.

So to answer your question I would say this is a configuration problem and you need to adapt your code.

Related Question