shrug-l: Field Calculating for Hyper linking in ModelBuilder

Griffin, Jason jgriffin at co.pinellas.fl.us
Thu Dec 15 13:49:11 EST 2011


You can do it in ModelBuilder...

There is a ModelBuilder only tool called Parse Path.  From a new model (editing window) right-click in and go to Model Only Tools, then choose the Parse Path tool.  Choose the option for path.  This gives you the:  c:\whatever\wherever\maybeinadbsomewhere.gdb value.  This variable will be called value by default.

The next part is that you want to get the name of the source image.  We will get that from the model iterator:  Iterate Datasets (This is a ModelBuilder only feature, as well, so you will have to right-click and go this time to Model Iterators to choose it).  You are going to set the data type to Rasters because those are the only files you are interested in, and then you are going to set the top level folder/workspace location that contains all of the images (Workspaces can also be geodatabases).  You also have the option to make the model run recursively within the selected folders which will dig deeper and deeper until all subfolders/data have been exhausted (If you were in a geodatabase the equivalent would be feature datasets).  So that is great, and as an output it gives you the name of the raster as well.

We are going to call on this later to create the field calculation for your attribute table:  "c:\whatever\wherever\maybeinadbsomewhere.gdb\yourraster.format" However, to get the values collected by the "value" and "name" variables of each iteration we are going to use what is called variable substitution.

In the calculate field tool you will specify the field you want to calculate and then the calculation will be:  "%value%\%name%" It needs to be in quotes because the values are strings, and you need to add the backslash because it is not included in the value variable from the Parse Paths tool.  This makes the folder path work properly.  The name variable may not contain the file format in which case you need to change the calculation to:  "%value%\%name%.tif" for example.

Now you just need to do a few things, first add the hyperlink field to your data, then apply the calculation above, to the appropriate record in your table.  To do this you will need a selection geoprocessing tool such as Make Table View with the definition query set to [Your Field] = %name% this will select only the appropriate row, and then you run the calculate field tool w/ the expression discussed above.

So now you have a tool that will update a table.  Not sure if this will work for your case, but best of luck!

There is a very good geoprocessing blog hosted by ESRI that may be a resource worth looking in to:  http://blogs.esri.com/Dev/blogs/geoprocessing  Look for articles by Shitij Mehta and you will find excellent information on iteration and I believe variable substitution.

[cid:image001.png at 01CCBB2F.9B91EA70]

Jason A. Griffin, Ext. 33613 | BTS Senior Technology Specialist, GIS Dev. | Pinellas County Government, Business Technology Services [BTS] | 400 S Ft. Harrison Ave | Clearwater, FL  33756 | Tel: 727-453-3613 | Cell: 727-600-6634 | JGriffin at co.pinellas.fl.us<mailto:JGriffin at co.pinellas.fl.us>|

From: shrug-l-bounces at lists.dep.state.fl.us [mailto:shrug-l-bounces at lists.dep.state.fl.us] On Behalf Of Jeffrey Reed
Sent: Thursday, December 15, 2011 10:50 AM
To: shrug-l at lists.dep.state.fl.us
Subject: shrug-l: Field Calculating SQLserver paths for hyperlinking images

I'm working on ARC10 and we have images on a SQL server and I want to field calculate their paths that way the images are hyperlinked inside the attribute table.  I've read through ARC's help on the subject, but they don't have any examples to help me with the code.  So shruggers.........anyone have any help for me?  Whether it's a link or just some suggestions, I'll take it.  Thanks.

--
Jeffrey Reed
GIS
Information Technology Department/Emerald Coast Utilities Authority
P.O. Box 15311
9300 Sturdevant Street
Pensacola, FL 32514
(850)-969-6672
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20111215/8b84e8ca/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 57487 bytes
Desc: image001.png
Url : http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20111215/8b84e8ca/image001.png


More information about the SHRUG-L mailing list