Attribute Assistant IIF()

817
2
10-04-2017 03:04 PM
Labels (1)
JoeBorgione
MVP Emeritus

One of my expressions is an IIF() statement, and I keep getting errors in the log file.  For the life of me, I can't see what the problem is.  I've gone so far to simplify the expression but it still does not update the field. 

The logic:  

Update field [STR2_NAME] if another field (  [STR2_NAME_W_SPACES]  ) has letters in it.  If it does, populate field  [STR2_NAME]  with  the letter A otherwise, populate field [STR2_NAME] with the letter B.  As mentioned this is a very simplified version of my original IIF() which had a replace() function in it.  I tested the syntax of my replace() function in the original in a field calculator, so it was correct.  For the test, [STR2_NAME_W_SPACES] has a value of WHAT THE HECK

From the log file:

Row Info
Row Number 5
TableName: MasterStreetNameFC
FieldName: STR2_NAME
ValueInfo: IIF([STR2_NAME_W_SPACES] like '[A-Z]*', "A", "B")

IIF([STR2_NAME_W_SPACES]<'A',"A","B")  #### interesting that it's not <=   A LT sign should result in a number.....
ValueMethod: EXPRESSION
On Create: 1
On Change: 1

Checking for Subtype Restriction
Field Name: STR2_NAME was found at index: 4
Trying: EXPRESSION
replace field: STR2_NAME_W_SPACES with a value
Checking to verify there is a field to store the expression
Expression to be eval: IIF("WHAT THE HECK" like '[A-Z]*', "A", "B")
ERROR: evaluating the expression for feature in MasterStreetNameFC with OID of 20335
System.Runtime.InteropServices.COMException (0x800A03EA): Syntax error
at MSScriptControl.ScriptControlClass.Eval(String Expression)
at ArcGIS4LocalGovernment.AttributeAssistantEditorExtension.SetDynamicValues(IObject inObject, String mode, List`1& ChangeFeatureList, List`1& NewFeatureList, List`1& ChangeFeatureGeoList) in C:\Projects\GitHub\local-government-desktop-addins\Attribute Assistant Add In\AttributeAssistantAddIn\AttributeAssistantEditorExtension.cs:line 12266
Finished: EXPRESSION

That should just about do it....
Tags (2)
0 Kudos
2 Replies
MikeMillerGIS
Esri Frequent Contributor

Pretty sure vbscript does not support Like.

Try instr.

https://www.experts-exchange.com/questions/11460378/vbscript-like-operator.html 

0 Kudos
JoeBorgione
MVP Emeritus

Thanks Michael-  forgot this is vbscript not vba, which according to my searches does.  When I get back to work I'll give  instr() a try.

That should just about do it....
0 Kudos