Add join for 15 character Text Field

710
4
09-16-2021 06:32 AM
Labels (3)
Nono
by
New Contributor II

I'm trying to add join csv to an attribute table of a layer based on a 15 character number for US census blocks.  However the GEOID (15 char) field in the layer is a text field, creating a double or long duplicate field translates the 15 digits into scientific notion which incorrectly pairs during add join. 

0 Kudos
4 Replies
DavidPike
MVP Frequent Contributor

Strange, I thought the CSV would store it as a string.  Probably try putting the CSV into an FGDB table, ensure the field type is text (field calculate a new field if not - str(int(<value>)) ) or CSV to xls and set the format to text.

0 Kudos
Nono
by
New Contributor II

Okay so, I think I understand a little better what's happening. GEOID is 15 digits using str(int(<value>)) works, however the final two digits are disregarded- And they are essential. The first two digits however are not essential. So after a little looking around- it appears that str(int(!GEOID10!))[2:] will work just fine. 

0 Kudos
Nono
by
New Contributor II

That said, I'm painfully new to all this so if someone can enlighten me as to *why* I'd be super grateful. 

0 Kudos
DavidPike
MVP Frequent Contributor

Doesn't make sense to me either unless you have a default field length of 15 set (which would explain why its being truncated)?  are you able to share a sample of the data?

0 Kudos