Text string character formats in dbf files

506
7
02-21-2019 10:51 AM
DanielBrenner
New Contributor III

Is there a Help Document on Rules For Text Strings and their formats in Text fields in dbf files?

I have to do a lot of merging of files with a text string field and all to frequently I get error message 001156 regarding something in the text string I put in the text field and I go bonkers trying to figure out what it is.   I have been able to figure some things on my own but this is still a pain in the butt to  have to go through.   I have tried various queries in Help but nothing gets at what I'm talking about.

I have been able to fix errors like the ones below in the past (consistent character string recognition from one database to another) but then when I thought I'd figured it out things like the ones in the pics still come up.

Also:  Why is it when I am adding a Text field to a dbf file if I indicate a certain number of characters, after it becomes a part of the dbf file, it automatically goes to 255, even if I use the default of 50 when I am initially naming the Text field???

As in, why should I have to indicate what my field length is when I get this instead?

0 Kudos
7 Replies
DanPatterson_Retired
MVP Esteemed Contributor

first inclination looking at the rest of the data is drop the ;  a : seems ok but maybe not the semicolon

0 Kudos
DanielBrenner
New Contributor III

I managed to figure out a way to avoid the issue --it is/it was much bigger than a simple semi colon--but the really screwy thing that I only started noticing is how are some text fields only 50 characters and others are 254?  How do I get a 254 character field when I'm adding text fields?

0 Kudos
JoeBorgione
MVP Esteemed Contributor

 I have been able to figure some things on my own but this is still a pain in the butt to  have to go through. Welcome to the wonderful world of data editing. You've probably got a full head of dark hair: I did at one time too...

I have to ask though, is there a compelling reason to use .dbf tables?  How are you creating them, and setting the width of the text fields?

Edited to add:  I just stumbled upon this link and it reminds me why I avoid dbf tables about as much as I avoid excel tables...

can't wait to retire....
0 Kudos
DanielBrenner
New Contributor III

Joe,

It is not the width of fields that’s the issue, it’s the fact that I work with custom .csv files for an app based on a Highway Routes layer, which can require exporting of the shapefile created by the app and then editing the dbf in MS Excel/saving as .xlsx, then re-exporting as a .dbf then joining to another shapefile with core fields, and then once that has happened, re-organization of both thew core fields and the new fields needs to happen to create a decent sequence that will show up in the Identify window.

If you’re wondering why don’t I use geodatabases, care to tell me where I can find an MS Excel compatible .dbf file in a geodatabase layer?

0 Kudos
JoeBorgione
MVP Esteemed Contributor

How do I get a 254 character field when I'm adding text fields?

My question was based on what you mentioned above.^

Shapefiles and .dbf tables are lightweight and cheap; that's why they are still around.  It seems to me that your application needs a data format that is more robust.  Just sayin'.

can't wait to retire....
0 Kudos
DanielBrenner
New Contributor III

Ok, but haven’t you ever seen what I’m talking about?

It’s a matter of what button do I hit. I accept the default 50 characters for a Text field but then I see other text fields with 254.

How does that happen?

And what do you mean by more robust format when I have to deal with Quality Control issues such as adding fields and more ideally keeping them in the same order between .dbf/.xls/.csv?

And how do I edit a geodatabase file in MS Excel like I can with a .dbf? How come we can’t edit the tables that go with them in a software that offers WAY MORE flexibility than ArcGIS in the .dbf interface?

0 Kudos
JoeBorgione
MVP Esteemed Contributor

If you’re wondering why don’t I use geodatabases, care to tell me where I can find an MS Excel compatible .dbf file in a geodatabase layer?

You'll never have an actual .dbf in a geodatabase: they are two totally different data structures.  You can however, export any geodatabase feature class to a shapefile, which will move the attribute table of the geodatabase feature class into a .dbf.

It’s a matter of what button do I hit.  I accept the default 50 characters for a Text field but then I see other text fields with 254.

You're losing me here.  If you are working with an actual shapefile you can add a field in either ArcMap or ArcGIS Pro, and in the case of a text field, specify the width.  If you accept the default, that's what you are stuck with: set the length to 254 before you accept it:

And what do you mean by more robust format when I have to deal with Quality Control issues such as adding fields and more ideally keeping them in the same order between .dbf/.xls/.csv?

Since I don't know your exact workflow and/or data needs this is a tough one to respond to: you said earlier that you are merging data and the fact that you are going back and forth between excel and arcgis suggests to me your workflow would be better served in a true [geo]database format.

how do I edit a geodatabase file in MS Excel like I can with a .dbf? 

Quite frankly, you don't.  Edit geodatabase feature classes and tables in some flavor of ArcGIS Desktop.

How come we can’t edit the tables that go with them in a software that offers WAY MORE flexibility than ArcGIS in the .dbf interface?

Define flexibility.  ArcGIS Pro has added functionality for adding fields over ArcMap, perhaps you should take a closer look there.

can't wait to retire....
0 Kudos