Help with Attibute assistant: expression IIF

2362
6
12-11-2013 07:18 AM
Labels (1)
OscarKreekrug
New Contributor
Hi,

Usually i dont need to post on the forums, because a lot of my problems are allready coverd, but not this time....

Being very new to the functionality of the attribute assistant I can say I enjoy it very much. But I do have a problem when it comes to some exprseeions. Especially the IIF espression.

Here is my situation:

Field [elementsoort] = categories of features (input via domains)
Field [jaar_grote_ingreep] = the year when an action is recuired (ie 2023, manual input)

I got this to work:
IIF([elementsoort] = "hsA", ("eindkap " & [jaar_grote_ingreep]), "jaarlijks")

This is the expression I want gis to perform :
IIF([elementsoort] = "hsA" OR �??hwA OR �??esA�?� OR �??esB�?� OR �??hboA�?�, ("eindkap " & [jaar_grote_ingreep]), IIF([elementsoort] = "hsB" OR �??hwB OR �??hboB�?�, ("afzetten " & [jaar_grote_ingreep]), IIF([elementsoort] = �??db�?�, (�??schonen�?� & [jaar_grote_ingreep]), "jaarlijks" ) ) )

This should work (right?), but this expression is too long. There should be a way to make it shorter, but I can't figure it out.

Any idea's?
All the input would be greatly appreciated!

I am on windows 7, Arcmap 10.1 sp 1 for desktop, and the attribute assistant for 10.1.

Thanks!
K.
0 Kudos
6 Replies
TimWitt
Frequent Contributor
K,

I can't help you with the expression, but I have very long expressions in my table as well. All I needed to do is, recreate the VALUEINFO field and I allowed 2000 characters. It might be a good idea to do the for future use and you can use your expression until somebody else can shorten it for you 🙂

Hope this helps!

Tim
0 Kudos
OscarKreekrug
New Contributor
Thanks Tim, that could be a nice work around!
I'll post back here with the results.

All the best,
Kreekrug.
0 Kudos
OscarKreekrug
New Contributor
Alas, I can paste the expression without problems now, but the expression is not working.
I am probebly doing something wrong with the OR parameter, but I have no idea how to fix this.

Still help welcome!

Regards,
K
0 Kudos
MikeMillerGIS
Esri Frequent Contributor
To use an OR, you need to write a whole conditional statement.  Change all your OR's, example below.

[elementsoort] = "hsA" OR �??hwA

to

[elementsoort] = "hsA" OR [elementsoort] = �??hwA
0 Kudos
OscarKreekrug
New Contributor
Thank you for your help Mike, much appriciated.

K.
0 Kudos
GIS-Cambria
Occasional Contributor II
Using a little SQL in your expression might help to shorten it, but I can't be certain that it will work. Using the IN statement will eliminate the need to write so many elementsoort = "***" statements. The trick with the IN statement is making sure a text element is enclosed in quotes or apostrophes and separated by a comma. Using the IN with a numeric field does not require quotes or apostrophes, but does require a comma separator.

IIF([elementsoort] IN ("hsA", â??hwA", â??esAâ?�, â??esBâ?�, â??hboAâ?�), ("eindkap " & [jaar_grote_ingreep]), IIF([elementsoort] IN ("hsB", â??hwB", â??hboBâ?�), ("afzetten " & [jaar_grote_ingreep]), IIF([elementsoort] = â??dbâ?�, (â??schonenâ?� & [jaar_grote_ingreep]), "jaarlijks" ) ) )
0 Kudos