Difference between revisions of "Field Calculator"
(Created page with "Useful functions for the field calculator. ===Situs from components (python)=== Pre-logic: <pre>def concat_address(lnum, hnum, sdir, sname, stype): outstr = lnum if hn...") |
m |
||
| (One intermediate revision by the same user not shown) | |||
| Line 13: | Line 13: | ||
field = | field = | ||
<pre>concat_address(!LO_ADDRESS!, !HI_ADDRESS!, !STDIR!, !STNAME!, !STTYPE!)</pre> | <pre>concat_address(!LO_ADDRESS!, !HI_ADDRESS!, !STDIR!, !STNAME!, !STTYPE!)</pre> | ||
| + | ===Parcels FACILITYID (python)=== | ||
| + | Highlight the new parcels (don't calculate everything) and find the current highest FACILITYID.<br> | ||
| + | Pre-logic: | ||
| + | <pre>id = (enter the current highest here) | ||
| + | def getid(): | ||
| + | global id | ||
| + | id += 1 | ||
| + | return id</pre> | ||
| + | FACILITYID= | ||
| + | <pre>getid()</pre> | ||
| + | |||
| + | ===Parcels/CountyParcels PROPERTY (vb)=== | ||
| + | Pre-logic: | ||
| + | <pre>tval = Len ( [PROP_ID] ) | ||
| + | if tval > 4 then | ||
| + | rval = "R" | ||
| + | elseif tval > 3 then | ||
| + | rval = "R0" | ||
| + | elseif tval > 2 then | ||
| + | rval = "R00" | ||
| + | else | ||
| + | rval = "R000" | ||
| + | end if</pre> | ||
| + | PROPERTY = | ||
| + | <pre>rval& [PROP_ID]</pre> | ||
| + | |||
| + | [[Category:Scripts]] | ||
Latest revision as of 16:31, 4 September 2015
Useful functions for the field calculator.
Situs from components (python)[edit]
Pre-logic:
def concat_address(lnum, hnum, sdir, sname, stype):
outstr = lnum
if hnum <> "0":
outstr += "-"+hnum
if sdir.isalpha():
outstr += " "+sdir
outstr += " "+sname+" "+stype
return outstr
field =
concat_address(!LO_ADDRESS!, !HI_ADDRESS!, !STDIR!, !STNAME!, !STTYPE!)
Parcels FACILITYID (python)[edit]
Highlight the new parcels (don't calculate everything) and find the current highest FACILITYID.
Pre-logic:
id = (enter the current highest here) def getid(): global id id += 1 return id
FACILITYID=
getid()
Parcels/CountyParcels PROPERTY (vb)[edit]
Pre-logic:
tval = Len ( [PROP_ID] ) if tval > 4 then rval = "R" elseif tval > 3 then rval = "R0" elseif tval > 2 then rval = "R00" else rval = "R000" end if
PROPERTY =
rval& [PROP_ID]