In ArcGIS 10.3 using the field calculator, I'm trying to concatenate a census tract field (double) with a census block field (double) into a single field that has the two values separated by a decimal point (ex: 501.3001 ) and then generate a summary table that has counts for how many times each census block occurs. I'm having trouble combining these two fields with a decimal point in between them. Should the new field be text? double? floating point?
-
The new field should be text, I wouldn't use a floating-point field to hold identification values like block and lot numbers.– Dan CMar 9, 2016 at 18:53
-
1Yeah, are these tract/block ID codes, or are these values associated with tracts/blocks. Also, this feels like an XY Problem: meta.stackexchange.com/a/66378. What are you ultimately trying to accomplish?– TomMar 9, 2016 at 18:55
2 Answers
Your output field should be a text field. If you set the field calculator's parser to Python, you could enter this for the formula:
'{}.{}'.format( !TractField! , !BlockField! )
If they really are double fields storing integer IDs for tracts and blocks, then enter:
'{}.{}'.format( int(!TractField!) , int(!BlockField!) )
If they are double fields storing some truly non-integer value and you want to round them to the nearest integer, use:
'{}.{}'.format( int(round(!SHAPE_Length!, 0)) , int(round(!SHAPE_Area!, 0)))
Note that if you were to set up the output field as a double/float, then you would lose any trailing zeros in your block values. 100 would become 1.
-
Great it worked I've got my new field and am able to summarize counts for each block. Thanks for the help Tom, I really appreciate it! Mar 9, 2016 at 20:47
Text field should be your output field. the above answer works, another way to do this would be
"!TractField!"+"."+"!BlockField!"
-
1