jamieneils

Using the Field Calculator (python) to create Full Path Name for hyperlink

Discussion created by jamieneils on May 25, 2012
Latest reply on May 25, 2012 by curtvprice
I'm trying to use the field calculator to populate the field "Hyperlink1" with the full path name of the document.  I have a field called "DOC_NO" and if there is a document number in it, I would like the field "Hyperlink1" to fill in the path name with the document number.  If there is no text in "DOC_NO" I do not want any text in the "Hyperlink1" field.  But I can't seem to get it work right.  Can anyone take a look?

Pre-Logic Script Code:

def myfunction(docno) :
if len(!DOC_NO!) == 0 :
    return ''"
  else:
    return "V:\Eng\Land Management\Easements\Scanned Documents\" + !DOC_NO! + ".tif"

Hyperlink1=
myfunction( !DOC_NO! )

Outcomes