Select to view content in your preferred language

Generate unique id/way point?

3336
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
RolfBroch
Frequent Contributor
ArcPad can generate a unique id using

strID = System.CreateGuid

request.

Rolf
0 Kudos
jeremysarrow
Emerging Contributor
Rolf, I'm a bit of a novice with ArcPad.  Would I do this script in ArcStudio in the axf file on the desk top, create a new field for the unique ID and then load it into the Trimble unit?  Thanks for any additional guidance on how to do this.
0 Kudos
JayKappy
Frequent Contributor
Rolf

ArcPad can generate a unique id using
strID = System.CreateGuid

Is it as simple as:
Dim Test
Test = System.CreateGuid

How is this number being created?  I have code that grabs the max ID from a field and adds 1 to create a new id, but am interseted in this approach....
Looking to test time differences on the Juno unit to see which is more eficiant...I would imagin eht eCreateGuid would be since I dont hav to build and run the SQL query....

Any thoughts to how the CreateGuid is created?

Thanks
0 Kudos
JayKappy
Frequent Contributor
Rolf, I'm a bit of a novice with ArcPad.  Would I do this script in ArcStudio in the axf file on the desk top, create a new field for the unique ID and then load it into the Trimble unit?  Thanks for any additional guidance on how to do this.


jsarrow....yes you would have to do it in ArcStudio.....I can show you but basically if this is workign as I think:

OnFormOpen you would declare a global varaiable.
This use this varaible to populate a textbox that is set to the UNique attribute.....

Something like this:

In ArcStudio under Feature Layers you should see the layer you are going after.  Double Click it
This will open the design mode for the form
when you open the form in design mode click Form Tab and properties.
There is then a Events Tab
CLick this and then click "OnLoad"
In the box write:  Call UniqueID
This will be the Sub routine you will create later

Close this dialog but not the one for the form....THere is a little blue script in the tool bar (edit script)
Click this to create a new script page.
In that script page do something like this.

NOTE:
Outfalls below is the naem of the layer that I am going to be updating....
page1 is the page number, or the tab number...depends on how many tabs you have and which one....you can click the tab in design mode and click "Page" "Properties" then Name is what you would use there....it defaults to (page1, page2, page3 etc)

In the script page place this code there...on load it should call this sub routine, create the unique id and assign it to the textbox of your chooseing...when you close the record this will be assign to the field attribute

In my case:
Outfalls is the feature class I am updating
its on page1 or the first tab
Edit1 is the name of the textbox I am updating on page1


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
0 Kudos
JayKappy
Frequent Contributor
My only thought on that....I jsut tested it and it works...is the long number.
I am using my Unique ID to create photo names etc.  If you have a 30 digit number in front of the image it makes things tough....

On forom load I simply query my feature class and find the Max number in a number field.
I then add 1 to the number and assign it as the new Unique number...

This way I have can rename my images to something like this

Unique ID _ Field Name _ Time Stamp . jpg

234_Image1_5_5_2010.jpg

Then in ArcGIS I can click a feature and get its unique ID, then query a folder for all images that start with that unique number.

Just a thought
0 Kudos
jeremysarrow
Emerging Contributor
Thanks for all the detailed info jay.  I'll give it a try and let you know how it works out!

Thanks,
0 Kudos
DaveAlmond
Regular Contributor
All-
We gave up on relying on ArcPad to generate unique IDs for us and simply use the Julian Date (yymmdd +24:00 time) which also allows us to sort our files by date/time of creation.  You could add seconds if you 're blazing through more than one feature per minute, but the best part....no coding necessary!
0 Kudos
KearyHowley
Deactivated User
Hi Stormwater12,

I tried to use the AXF data/time stamp to implement your recommended Julian Date (yymmdd +24:00 time) method to log a unique feature ID.  This works fine on ArcPad in the field.  The issue I'm having now is the values are being dropped when I check the data back into the file geodatabase.  Have you experienced this issue?  A little more inof on how you set this up would be appreciated.
Thx
0 Kudos
DaveAlmond
Regular Contributor
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.
0 Kudos