Select to view content in your preferred language

Attribute Assistant - Expression Method and Parsing

3303
0
05-17-2013 06:18 AM
Labels (1)
JeanneBaker
New Contributor
I've searched the forum hoping that someone had posted which Visual Basic functions the Expression Method of Attribute Assistant supports. The function that seems to be having problems is the string function Mid. I would also like to know if there is a limit to the complexity of IIF statements - maximum nesting level.

What I would like to do is parse an address field into separate fields: Street Name, Street Direction, Street Type.  Street Number and Address Unit are in fields that can be copied.  I've tested the VB code in Access and it appears to work.

Here is the code for parsing the different fields along with the error codes from Attribute Assistant log file:

PAR_STRDIR:
IIf(InStr((InStr([ADDRESS]," ")+1),[ADDRESS]," ")-(InStr([ADDRESS]," ")+1)=1,Mid([ADDRESS],(InStr([ADDRESS]," ")+1),1))

ERROR: evaluating the expression for feature in iabdf with OID of 10
                         Wrong number of arguments or invalid property assignment: 'IIF'
STR_NAM:
IIf(IsNull([PAR_STRDIR]),(IIf(IsNull([PAR_STRUNI]),Mid([ADDRESS],(Len([PAR_STRNO])+2),(Len([ADDRESS])-Len([PAR_STRNO])-Len([PAR_STRTYP])-2)),Mid([ADDRESS],(Len([PAR_STRNO])+2),(Len([ADDRESS])-Len([PAR_STRNO])-Len([PAR_STRTYP])-Len([PAR_STRUNI])-3)))),(IIf(IsNull([PAR_STRUNI]),Mid([ADDRESS],(Len([PAR_STRNO])+4),(Len([ADDRESS])-Len([PAR_STRNO])-Len([PAR_STRTYP])-Len([PAR_STRDIR])-3)),Mid([ADDRESS],(Len([PAR_STRNO])+4),(Len([ADDRESS])-Len([PAR_STRNO])-Len([PAR_STRTYP])-Len([PAR_STRUNI])-Len([PAR_STRDIR])-4)))))

ERROR: evaluating the expression for feature in iabdf with OID of 9
                         Invalid procedure call or argument: 'Mid'

PAR_STRTYP:
IIf(IsNull([PAR_STRUNI]),Mid([ADDRESS],(InStrRev([ADDRESS]," ")+1),(Len([ADDRESS])-InStrRev([ADDRESS]," "))),Mid([ADDRESS],(InStrRev([ADDRESS]," ",(Len([ADDRESS])-Len([PAR_STRUNI])-1))+1),(Len([ADDRESS])-Len([PAR_STRUNI])-InStrRev([ADDRESS]," ",(Len([ADDRESS])-Len([PAR_STRUNI])-1))-1)))

ERROR: evaluating the expression for feature in iabdf with OID of 9
                         Invalid procedure call or argument: 'Mid'

Has anyone else had problems using VB string functions in the Expression Method?

Thanks,
Jeanne
0 Kudos
0 Replies