2

Using the Attribute Assistant in ArcGIS 10.5, I auto-populate a field called FULLADDR by entering values for the fields below:

([ADDRNUM]+" "+[ROADPREDIR]+" "+[FULLNAME]+" "+[ROADPOSTDIR]+" "+[UNITTYPE]+" "+[UNITID])

If there is no ROADPREDIR, a space is entered into the FULLADDR field where the ROADPREDIR would be if it existed. I would like to ensure that if there is no ROADPREDIR value there will be no space between fields ADDRNUM and FULLNAME from the equation above.

  • 1
    Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. – Midavalo May 19 '17 at 21:20
  • Which Attribute Assistant function are you using to auto-populate the field? Can you give the entire AA line from your Dynamic Value table? – Midavalo May 19 '17 at 21:33
2

Without any other info, I'd suggest trying the IIF function in your expression to check if there's a value for ROADPREDIR, and if there isn't skip it.

([ADDRNUM] + IIF(isNull([ROADPREDIR]), "", " " + [ROADPREDIR]) + " " + [FULLNAME] + " " + [ROADPOSTDIR] + " " + [UNITTYPE] + " " + [UNITID])

Please note I haven't tested this as I don't have Attribute Assistant available from this PC to test.

Another way to try this is to put the whole expression into the IIF() - one with the ROADPREDIR and one without:

IIF(isNull([ROADPREDIR]), ([ADDRNUM] + " " + [FULLNAME] + " " + [ROADPOSTDIR] + " " + [UNITTYPE] + " " + [UNITID]), ([ADDRNUM] + " " + [ROADPREDIR] + " " + [FULLNAME] + " " + [ROADPOSTDIR] + " " + [UNITTYPE] + " " + [UNITID])
0

Think of the values that do have to be there (ADDRNUM, FULLNAME) and join them to the ones not there including a trim.

TRIM([ADDRNUM]+" "+[ROADPREDIR])+" "+ TRIM([FULLNAME]+" "+[ROADPOSTDIR])+" "+TRIM([UNITTYPE]+" "+[UNITID])

TRIM([ADDRNUM]+" "+[ROADPREDIR]) --> if Roadpredir is not there, you will have two spaces on the right ("999  ")  which get eliminated with the TRIM. 

+" "+ TRIM([FULLNAME]+" "+[ROADPOSTDIR]) + " "

You then have an space (mandatory) before the FULLNAME, and join it with the POSTDIR which might not be there. If PostDir is not there, you again get two spaces on the right (" ", that go away after the TRIM.

TRIM([UNITTYPE]+" "+[UNITID])

if unit type is not there, you have two spaces on the right that go away with that TRIM also. If UnitType is not there, the TRIM also takes care of it, same if both are not there.

Lastly, you are left with one space on the right (after POSTDIR) if both UnitType and ID are not there. This will be taken care off if you include an overall trim.

TRIM  (TRIM([ADDRNUM]+" "+[ROADPREDIR])+" "+ TRIM([FULLNAME]+" "+[ROADPOSTDIR])+" "+TRIM([UNITTYPE]+" "+[UNITID])  )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.