Select to view content in your preferred language

autoincrement an interger field

3596
4
05-10-2012 04:43 PM
EdSchools
Emerging Contributor
I cannot get ArcPad to auto increment an integer field in a feature layer but it will in a shapefile. I have a shapefile with a custom form. Every time the user makes a new point in the shapefile, the integer field increments. All I had to do was check the auto increment box in the control properties and it works great. If I import the shapefile into a geodatabase and check it out as an axf file the function does not work. In ArcPad the field is grayed out and will not show a value. Is there a reason this seemingly simple function works with a shapefile but not an axf file?
Tags (3)
0 Kudos
4 Replies
SteveFitzgerald
Occasional Contributor
schoolse,
My understanding is that there are certain things that the SQLCE based AXF format cannot do and auto-increment is one of them - at least not the way the old shapefile/Arcpad form did it. There is a unique identifier for each record inside the AXF (AXF_OBJECTID) but I'm not sure it can (or should) be used as an increment ID.
On the brighter side there are many things the AXF can do that the old shapefile/Arcpad form cannot (like lightening quick queries).
If you are using scripts then there are examples around of auto-increment routines that should work with AXF format.
It would be good to have a list of the things that don't work with AXF and the best work-arounds as it can be frustrating if you are updating forms from Shapefile layers to AXF layers.
Steve
0 Kudos
EdSchools
Emerging Contributor
Steve,

Thanks. Is there a way to view the AXF_OBJECTID on the edit form? The user needs to see the number when they create a shape. I tried assigning the AXF_OBJECTID to a control on the edit form but it would not display the value.

In our workflow the user maps a shape, fills in some basic attribute information using a custom form, then collects extensive ecological data on a paper form. I need a unique number along with an identifier for the handheld unit to allow matching the shape with the paper form. I have multiple users using multiple units throughout the field season. This precludes putting a unique number of the paper forms and assigning that number to the newly created shape via the edit form. Any given user will not have all the previous field forms with them so they will not know what number to use.

I really wanted to move us to the AXF files but it looks like we will be using shapefiles.

ed
0 Kudos
SteveFitzgerald
Occasional Contributor
Ed,
I don't recommend using the AXF_OBJECTID.
Here is a script example that takes a users log-in name and adds a date/time serial number to it to form a unique ID (unless users log-in with duplicate names of course!).
If you like it then you should make a log-on form rather than the input box I have used for the example and use a a combo box of acceptable log-in names with some validation.
The script of interest in the example is 'GetUniqueDt" and the Applet that runs at the start. I have put it in with another example that I posted at http://forums.arcgis.com/threads/3138-Generate-unique-id-way-point?p=198347&viewfull=1#post198347 this morning which may be of interest too but probably not useful if users have to write the number on a form.
Using the GetUniqueDt example the user should only have to write their log-in name, today's date and time (exactly as shown in form... just added a msgbox telling user what to put in paper field form).
Regards,
STeve
0 Kudos
EdSchools
Emerging Contributor
Steve,
Many thanks. I'm a bit tied up with another crisis so I probably can't get to this until next week. Again, thank you.
ed
0 Kudos