0

I have a model where the user selects a string from a drop down list which is used to select a building point and run a series of trace operations. This works fine on desktop, but keeps returning the same data when ran from the server. It turns out that when the process is published after being run from 'any building', it only uses that building name when run from the server, no matter what is selected by the user. It seems that the request is sending the correct string, but the GP service is not accepting it or changing the input parameter string.

The job is submitting the correct string selected by the user Job run with initial value it was published with

I do not understand why the input parameter does not change based on the selected input. I am using a field seletion tool I found online that seems to work perfectly when run on the desktop.

enter image description here

Does anyone have any idea as o why the input is not being changed??

EDIT: He is the 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()
 self.fcfield = (None, None)
 def initializeParameters(self):
 """Refine the properties of a tool's parameters. This method is
 called when the tool is opened."""
 return
 def updateParameters(self):
 """Modify the values and properties of parameters before internal
 validation is performed. This method is called whenever a parmater
 has been changed."""
 if self.params[0].value and self.params[1].value:
 fc, col = str(self.params[0].value), str(self.params[1].value)
 if self.fcfield != (fc, col):
 self.fcfield = (fc, col)
 self.params[2].filter.list = [str(val) for val in
 sorted(
 set(
 row.getValue(col)
 for row in arcpy.SearchCursor(fc, None, None,
 col)
 )
 )
 ]
 if self.params[2].value not in self.params[2].filter.list:
 self.params[2].value = self.params[2].filter.list[0]
 def updateMessages(self):
 """Modify the messages created by internal validation for each tool
 parameter. This method is called after internal validation."""
 return
asked Feb 27, 2015 at 16:28
4
  • I cant make your screen shots bigger to see exactly what you're trying to show, but the last one looks like validator code? I dont know what its doing exactly, but understand a GP Service doesnt have the same validator code experience you get in desktop. That said, the code will still run when you execute the service. So if validation sets a parameter, it might be doing something you dont expect it to be as a service. Commented Feb 27, 2015 at 16:39
  • I have added the block of code from the script validation. Is there anyway to check this server side? Commented Feb 27, 2015 at 16:52
  • 1
    Ok, that makes sense what you're doing. Not sure its the issue. Easiest way to check, make a copy of your script tool and strip the validator code and just pass in values you know are correct. After that, publish and see if you get the same issue. That'll narrow it down some. Commented Feb 27, 2015 at 18:01
  • I figured out its not the script tool at all. I removed the whole thing and simple passed in a string with a building name into the select operation, and it still returns the same data it was published with Commented Mar 3, 2015 at 13:46

1 Answer 1

1

I figured out the issue, but I can't say I fully understand it. On the far left side of my screen shot, you can see a wMain layer, this was being used to select the pipe sections intersecting the building points. This wMain layer was one that was loaded into the MXD I was working off and that gets copied to the server. Turns out the correct building points were being passed and used in the GP service, but after being published, the wMain layer data would not get overwritten. Whatever building it would run as, those were the only sections your would ever get.

I instead used the source FC from the SDE and created a layer from it in the model, and ran the select location off that layer. I assume this is working be it is always making a fresh layer from the data, but I don't really understand why. The layer in the MXD is referencing the same data, so why would this not work over creating a new layer?

@KHibma helped me to rule out the script tool.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
answered Mar 3, 2015 at 17:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.