Select to view content in your preferred language

Generate unique id/way point?

3993
15
04-22-2010 07:00 AM
jeremysarrow
Emerging Contributor
Trying to have a point shape file that generates a unique id in arc pad while collecting data in the filed.  I know there is the Object ID number but this does not show up until after you are done entering data.  I basically need a unique id like a way point that the field person can see while entering the data and write down in their field notes as well.

Any ideas greatly appreciated.
Tags (3)
0 Kudos
15 Replies
RobertMcCann
Deactivated User
We simply created a field for out unique ID and enter it manually. So if I was entering the unique ID at the time of this writing, I would simply enter 1107271120 for 11-year, 07-Month, 27-day, 1120- hour. It requires typing with each feature created, but it is simple.


This is an absolutely horrible idea...  At least set the default value of a date field to "now()".  As soon as you have more than one field user, this method will NOT WORK!

Currently (ArcPad 10) if you add a GUID field to your feature class in a GDB and check it out to ArcPad, it will set the default value to "newid()" which will give you an unique ID every time.  I suggest doing it this way.
0 Kudos
DaveAlmond
Regular Contributor
If you have more than one field staff entering data in the same feature class during the same minute then you could certainly duplicate IDs. I am the only person at my organization creating and editing our field data, so we have used this method for two years without any duplicates or issues.  In the end, it is much easier to manually enter the Julian date instead of relying on or programming ArcPad to create unique IDs. I think most folks here are able to distinguish what will work for their intended application instead of opting for thoughtless hyperbole in lieu of rational consideration....
0 Kudos
KyleSato
Emerging Contributor
Option Explicit
Dim varUniqueID

Sub UniqueID

 ' CREATE THE VARAIBLE AND ASSIGN IT THE CREATED GUID
 ' Dim createUniqueID
                ' I commented this varaible out because I delclared it global above in the option explicit...you can delete the global varaible and declare it here if you want...
                ' globally you can do other stuff with it...
 varUniqueID= System.CreateGuid

 ' NEXT YOU HAVE TO GRAB THE FORM PAGE AND ASSIGN THE VARAIBLE TO THE TEXTBOX

 Dim objRS, objSelLayer, objEFPageOneControls3, objEditForm3
 Set objSelLayer = Map.SelectionLayer
 Set objRS = objSelLayer.Records
 objRS.Bookmark = Map.SelectionBookmark

 Set objEditForm3 = application.map.layers("Outfalls").forms("EDITFORM")
 Set objEFPageOneControls3 = objEditForm3.Pages("page1").Controls

 objEFPageOneControls3("Edit1").Value = varUniqueID

End Sub


Hi Jay, I too am new to coding. I have followed your instructions step by step, but for some reason the Unique ID field is blank. Do you have any other advice why this may not work on my unit? Any help is greatly appreciated.
Thanks!
Kyle
0 Kudos
SteveFitzgerald
Occasional Contributor
Kyle,
The attached example from above worked for me. Try it out on your system and let us know.

Steve
0 Kudos
KyleSato
Emerging Contributor
Hi Steve!
Thank you very much for your assistance. With your code I was able to get it to work. I think the problem was I wanted the Unique ID on a different page, where as the code is written for page one.
Thanks again for your help!
0 Kudos
BenjaminAmaira
New Contributor
Hi all

I know this is an old post but hoping this reply gets to the author or answers indox. 

I have used the script detailed by Clearybros11 to create the Unique ID in a field on my form and it works.  However, when I load the form I get a message saying:

Microsoft VBScript Runtime Error
Object Required: 'Applet'
[Line: 2 Column: 1]
Source Text Unavailable

I can close the message and carry on inputting my data and it is recoverable from ArcPad for use in ArcMap.  However, I envisage several queries from the form users if I can't get rid of this error message appearing everytime they want to record data.

Can anyone help stop this happening?

Thank you for any help.

Regards
0 Kudos