Attribute Assistant Expression help

6205
12
09-15-2011 01:46 PM
LarryPhillips
New Contributor II
Where can I find documentation on what type of arguments work with the expression value method in the DynamicTable for the infrastructure editing toolbar's attribute assistant?

I'm having some trouble with data types among other things.  One example looks like this:

...IIF([INSTDATE]="","NONE",YEAR([INSTDATE]))...

I get an error of wrong data type while this work fine:

...", YEAR INSTALLED " & YEAR([INSTDATE])...

I used the "" because I could not figure out the syntax for ISNULL.

I get alot of syntax errors not knowing what functions/operators work with the Expression Value Method.
0 Kudos
12 Replies
LarryPhillips
New Contributor II
What I am trying to do is populate a unit description field.  A text field verbally describing the asset's attributes.  The difficulty with this is that I need to say when I don't have attributes. i.e.; ASBUILT NONE, MANHOLE DEPTH UNKNOWN. As opposed to ASBUILT 05-1515, MANHOLE DEPTH 5.7FT.

So what I attempted to do was evaluate if the attribute had a value or not and then populate accordingly.  Well this works fine if it's a new feature.  But when I find that my manhole depth is incorrect because the invert was set to "0" and I "<null>" the data the attribute assistant fails.

And I was trying to use the ="" where I could because the isnull has a syntax error when the value IS NULL. I attempted to us Cstr() to force it to work too. Oh well.

Words are such a sorry example of actual work.  😞 
I can only hope this explanation will help in the understanding of the previous post.  🙂
0 Kudos
MikeMillerGIS
Esri Frequent Contributor
I posted an updated version that handles IsNull a little better.  I tested you equation you sent me and it works if you remove the YEAR() part.  A IIF statement in VB evaluated both true and false parts, so you cannot pass a null in and define a process on it. 

Article explaining the IIF statement - http://msdn.microsoft.com/en-us/library/27ydhh0d(v=vs.80).aspx

Beta Version - http://forums.arcgis.com/threads/20000-Beta-Versions
0 Kudos
LarryPhillips
New Contributor II
Thanks so much!!  The isnull works!

I also did not realize the iif statement evaluated both true/false parts.  So now when I evaluate the is null I populate a string "SetFromSomeField" and then use the Replace() to set it, works with Year() too.

Run_order | Value_info
1]             | [UNITDESC] & ", MH DEPTH " & IIF(isNull([MHDPTH]),"UNKNOWN","SetMhDpth")
2]             | REPLACE([UNITDESC],"SetMhDpth",[MHDPTH] & "FT")
0 Kudos