AnsweredAssumed Answered

GP service does not work

Question asked by modybsystematics-co-il-esridist Employee on Nov 18, 2015
Latest reply on Nov 22, 2015 by modybsystematics-co-il-esridist

Hi all

 

I would like to make a gp tool that return a layer that is a join between a layer and a table Below is a sample of one of my tries in python.

The output parameter is define as derived

The tool run in desktop and published but give error in server.

I do not want the user to give output name so I must define the output as derived.

Should I write my output to %scratchworkspace%?

Do I have to create a real feature class?

What is the right way to do it?

 

Thanks

Mody

 

 

 

import arcpy

tableName = arcpy.GetParameterAsText(0)

layerName = arcpy.GetParameterAsText(1)

 

# Local variables:

dbPath = r"C:\tmp\Mody.gdb"

local_table = os.path.join(dbPath ,tableName)

local_layer = os.path.join(dbPath ,layerName)

 

featureClassSelect = "Year = 2004"

arcpy.MakeFeatureLayer_management(local_layer,"t1",featureClassSelect)

arcpy.AddJoin_management("t1", "ID", local_table, "ID")

 

arcpy.CopyFeatures_management("t1",r"outFCPersistent")

arcpy.Delete_management("t1")

arcpy.SetParameterAsText(2,r"outFCPersistent")

Outcomes