This whole thing started when I wanted to make a random number column and populate it in an attribute table.
I added a column to the table called "Rnd" (type double).
Then I opened the field calculator to populate this with a random number. But then I noticed that it was already populated with a number, all the same.
Even when I calculated the field to any number (in this case 2), a different random float would appear.
Even opening the table would generate another.
Strangely, after the calc above, I closed ArcMap, and opened the table in Access (this is in a personal geodb), the contents = 2.
Is this behavior, for a field called "Rnd" documented anywhere?
And, just in case I am totally loosing it, can someone confirm that this happens on another system.
My version 10.2.2.
Thanks.
Solved! Go to Solution.
I do see the same behaviour with Rnd as field name (v10.2.2). It appears to be a problem (bug or feature?) with using an unhandled VBScript (or VBA possibly) function as a field name. I see similar behaviour using Now as a string field name: the Now() function returns a string of the current date/time. The Now() function appears to be called every time field calculator is opened.
Some field names are reserved, like "Date", which indicates some VB functions have been handled, but not all.
Perhaps a 64-bit issue?
I'm not 100% sure on this, but maybe research the future of the Personal GDB.
I'm on 10.2.2 and just tested this with a new Personal GDB and did not have the same issue. The Rnd field was not automatically populated.
In your OP you stated that this problem occurred with the PGDB:
I closed ArcMap, and opened the table in Access (this is in a personal geodb)
I was commenting that since Access is a 32-bit application, perhaps the problems are associated with ArcGIS accessing that application. I don't have a definitive solution or even if that is your problem, it was just a comment to perhaps check into.
I would definitely be concerned with implementing PGDB's though and consider the future of that technology.
I do see the same behaviour with Rnd as field name (v10.2.2). It appears to be a problem (bug or feature?) with using an unhandled VBScript (or VBA possibly) function as a field name. I see similar behaviour using Now as a string field name: the Now() function returns a string of the current date/time. The Now() function appears to be called every time field calculator is opened.
Some field names are reserved, like "Date", which indicates some VB functions have been handled, but not all.
Darren, thanks for confirming this and for providing a possible explanation.
Will try a "Now" attribute as well.
Darren is absolutely spot on.
A field named Now (as a date) has the same result. Automatically populated...
The only question is...
Is this an undocumented feature or an undocumented bug.
I wouldn't necessarily describe it as a bug or a problem. It's pretty common to not use reserved words as a practice and a good habit to get into. In rare cases where I needed to name a field close to a reserved word then I'd just add an underscore "_" in front of the name.