I have create a script and want to add it to the model I have provided. The code is:

import sys, string, os
import arcpy
import numpy
Table = arcpy.GetParameterAsText(0)
Field1 = arcpy.GetParameterAsText(1)
Field2 = arcpy.GetParameterAsText(2)

arr = arcpy.da.TableToNumPyArray(Table, Field1)
arcpy.AddField_management(Table, Field2 , "DOUBLE")

out = arcpy.SetParameterAsText(4, Table)

However I want to select a field of a feature and calculate the mean value of that field and with the result of the mean continue the rest of the analysis in the model. I have create 3 Parameters, that 1th is a table and the input field and output field. However, when I import the script tool in the model , there is no output feature that I could link it to the rest of the model. How can I do that? enter image description here

  • thank you for your feedback but the output is basicaly the same input. How to define it? – Lili May 31 '18 at 12:13
  • Check the help on arcpy's SetParameter & SetParameterAsText – Bjorn May 31 '18 at 12:41
  • I tried to define the output but still when I link it to the next tool in the model, it is not activated – Lili May 31 '18 at 13:20
  • 1
    Shouldn't the output parameter be number 3 not 4? – Hornbydd May 31 '18 at 17:40
  • 1
    Parameter should be 3. Please edit your question to include a screenshot and description of your script tool parameters – Midavalo Jun 1 '18 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.