russb17

Python Basic Function Help

Discussion created by russb17 on Nov 8, 2011
Latest reply on Nov 9, 2011 by bposthumus
I'm new to Phylon, I would like to use the Pre-Logic Script Code block to write a Python function to concatenate three attributes to populate a new field. Very simple basic stuff... I cannot get it to work. The pre-Logic Script Code:

def FillGISKey2(arg1,arg2,arg3):
  GISKey2 = arg1 + "-" + str(arg2) + "-" + str(arg3)
  return GISKey2

In the expression text box I call the function passing in the three attribute fields I want to string together. The first !WtrLatLon! is a 12 character text, the !SecNum! is an integer and the !SecDate!  is a date. The Expression Box:

FillGISKey2(!WtrLatLon!,!SecNum!,!SecDate!)

Can anyone see an issue with this and why it is not working? I get the following error within the geoprocessing results window:

ERROR 000539: Error running expression FillGISKey2("415254785412",1,"11/14/2011")
(these are the values from the first record I'm trying to send to the Python function)

Also is there a way I can Alt(Print Screen) my Field Calculator dialog box and past it into this posting environment. Sure would help other see what I'm seeing?

Thanks
RussB17

Outcomes