User Requested Sample - Incrementing ID's
We had a request at this year’s User Conference to show how
build a simple incremental counter. The scenario was that there are multiple people
collecting data but each collector has been given a starting range e.g. Fred: 20000
and Barney: 50000.
This range could change from day to day so the ability to
change the number was also important. Using ArcPad’s input box, each user can
open the map and type in their starting value and then two, one line, scripts
will keep it up to date.
This sample has been written into the Edit Form (APL) rather
than an applet. The reason for this is that the script is data centric and no
matter what map you open with this data in, the scripts will run. Remember
applets are predominantly used when you want to achieve consistent behavior whenever
any map is used.
You will see three scripts in the jScript file (Poles.js):
- initiateID() – When the map opens (with the points layer in
it), the input box appears for you to type in the starting ID.
- getID() – When the Edit Form is opened, the text box “NAME”
is populated with the current ID
- updateID() – When you press OK on the form the ID has 1
added to it.