I am trying to set a condition using Attribute Assistant. I have a feature layer (GPS_Meter) with a field called SYSTEM. The SYSTEM field is populated with Potable, Non-Potable, and Sewer. I am trying to auto populate another field (UID) with either DW, RW, or SS and the OBJECTID. I have the following populated in the DynamicValue table,
Table Name: GPS_Meter
Field Name: UID
Value Method: EXPRESSION
Value Info: IIF([SYSTEM]=Potable, "DW", IIF([SYSTEM]=Non-Potable, "RW", IIF([SYSTEM]=Sewer, "SS"))) & [OBJECTID]
I run AA for selected GPS_Meter points and the UID field does not get populated. Any help will be greatly appreciated.
Solved! Go to Solution.
Thank you all for your help. I had the last part of the IIF statement incorrect. I removed the IIF([SYSTEM]="Sewer" and it worked. Below is the updated expression
IIF([SYSTEM]="Potable", "DW", IIF([SYSTEM]="Non-Potable", "RW", "SS")) & [OBJECTID]
Is the SYSTEM field text? You'll need to enclose the values in quotes:
IIF([SYSTEM]="Potable", "DW", IIF([SYSTEM]="Non-Potable", "RW", IIF([SYSTEM]="Sewer", "SS"))) & [OBJECTID]
Paul,
Thanks for the reply. It is a text field. I added the quotes and still getting no results. The UID field does not get populated.
IIF was monkeypatched in the msscriptcontrol. I believe you need to do & inside it. I have never tested this. The logic may not work and you might need a second expression statement that fires after this one. Which is <The Edited Field> & [OBJECTID]
IIF([SYSTEM]=Potable, "DW" & [OBJECTID], IIF([SYSTEM]=Non-Potable, "RW" & [OBJECTID], IIF([SYSTEM]=Sewer, "SS" & [OBJECTID])))
Thank you all for your help. I had the last part of the IIF statement incorrect. I removed the IIF([SYSTEM]="Sewer" and it worked. Below is the updated expression
IIF([SYSTEM]="Potable", "DW", IIF([SYSTEM]="Non-Potable", "RW", "SS")) & [OBJECTID]