Pasting in null into text field, pasts the characters: <null> and not null itself

2624
8
03-21-2013 01:43 AM
TimLangner
Occasional Contributor III
Hi there

Has anyone else come across the following behaviour in ArcMap?

When I am editing an attribute table in a Feature class, sometimes I need to replace a single value in a field with null. I will often do this by simply coping one of the other fileds ear by which has a null value in it.

However I am finding that sometimes if I am pasting to a field which a a data type of text, it ends up storing the characters: <Null> rather than null itself.

As ArcMap displays Null values as <Null>, it is impossible for me to know when this is happening. I then find I have to locate them using a select by attribute query and use the field calculator  to replace them with null.

Now I could use the field calculator all the time but using it for one value takes longer than it goes to simply copy and paste a near by null.

I am using 10.1.1 but I find the problem occurs with any version of ArcMap I use from at least 9.3.1 onwards.

Kind regards


Tim
0 Kudos
8 Replies
JoeBorgione
MVP Emeritus
Take a look at this post :  http://forums.arcgis.com/threads/66673-Calculate-the-NULL-value-using-a-Field-Calculator

It provides a python and a vb script parser solution.
That should just about do it....
0 Kudos
TimLangner
Occasional Contributor III
Thanks for your reply. As it happens I had read that previously. However that doesn't address how I am getting the characters '<Null>' and not null itself.

As I mentioned previously I can use the field calculator to generate null but I don't wish to have to do that every time I have just 1 value that needs to be replaced.

I can of course delete the values in the field but instead of then showing <Null> it just leaves the field blank. I prefer to see <Null> in every field whilst I am working, where <Null> exists.

It is a minor point but I was interested if anyone else had noticed it. I wonder how many databases have the characters <Null> in them when the person viewing it, think it's null itself.
0 Kudos
JoeBorgione
MVP Emeritus
Okay; now I think I see what you mean. Can you use a domain where <null> value is one of the choices?  I have a couple text fields set up that way.
That should just about do it....
0 Kudos
TimLangner
Occasional Contributor III
Thanks for that. With domains I thought that just creates a list which is not much help as I am typing in many different things into the boxes that wouldn't be in the list. I do however use domains on other fields.

Thinking about it, how does one add null to a domain. Surely typing in null or <null> would produce characters rather than null itself.
0 Kudos
JoeBorgione
MVP Emeritus
Thanks for that. With domains I thought that just creates a list which is not much help as I am typing in many different things into the boxes that wouldn't be in the list. I do however use domains on other fields.

Thinking about it, how does one add null to a domain. Surely typing in null or <null> would produce characters rather than null itself.


I think what I did is set it to 'Allow NULL Values' = YES for the field. And then assigned the domain to the field.  That may not be helpful with you since your database is already set up.  The thing about domains is you can always calc a value of your choice; if working on a single record it provides a pick list to choose from, but you don't have to select the choice. You can enter in what you want, as long as it 'fits'; that is if you have a 2 character field, obviously a 10 character value won't fit.....

With respect to your original post, the key might be allowing null values; it's been a while since I set that database up and I just don't recall.

Hope this helps-
That should just about do it....
0 Kudos
TimLangner
Occasional Contributor III
Your right about the drop down list and entering other values. Not something I thought of. However that would be confusing for other users who have only basic GIS skills. Anyway I got around the problem by searching for the string '<Null>' but I d rather not have had to do such a thing because I shouldn't be able to generate the string '<Null>' given that I was only coping Null itself from another column and wishing to copy a string '<Null>'.

This may have something to do with the fact that when you copy values from the database to excel spreadsheets, it preserves the wording <Null>. That might be great for those copying to Excel but not great is copying internally as I have been doing. Of course if you export the spreadsheet I'm not sure if it includes the string <Null> then. It may not do.
0 Kudos
NathanHeick
Occasional Contributor II

I am having the same problem on version 10.6 using the Attribute Table.  If I copy-paste NULL values from one field to another, it pastes the text representation of NULL, not the value NULL.  Also, if I backspace in the field, it seems to leave an empty string in the cell, not NULL.  If I then right-click and select Delete, I still have an empty string in the cell.  This is a bug to me.

If, however, I use the Attribute Editor, I can just backspace in the field and it leaves a NULL value in the cell.  It behaves quite nice.

0 Kudos
JoeBorgione
MVP Emeritus

As you've discovered, copy/paste <Null> isn't a viable option; I don't that's a bug per se.  If you would rather have true <Null> value my suggestion is to select where YourFieldName = 'Null' (or what ever the text representation is) and then using the PYTHON parser in the field calculator:

YourFieldName = None

That should just about do it....
0 Kudos