Technical Tips
Tips for Customising ArcPad for Data Entry
by Ishara Kotiah, Senior Analyst |
Introduction
ArcPad Application Builder
ArcPad Customisation
Customising Data-entry
Forms
Connecting to an External Database
Summary
ESRI’s
ArcPad software is an easy-to-use, low-cost mobile mapping tool
that can be integrated with your corporate GIS. ArcPad provides
intuitive mapping, basic GIS query tools and GPS functionality
for recording locations. ArcPad can make field data collection
and verification fast, easy and accurate. ArcPad can be deployed
on a range of handheld PDA devices and tablet PC’s.
A mobile computing solution for verifying assets in the field
will general provide the user with relevant attributes of
the asset and mapping of the location of assets and contextual
themes. However, like any other situation where technology
is being introduced, the question has to be asked whether
the business can be efficiently served by native software
out-of-the box or whether the most cost-effective solution
involves customization to minimize training and support.
back to top
ArcPad Application Builder
The most successful mobile solutions involve designing a system architecture that
will support the business process workflow so that the user
has access to the right data at the right time and maintains
appropriate corporate data holdings. ArcPad can be can be readily
customised to deliver these solutions. ArcPad is customized
using ArcPad Application Builder.
This document provides an overview of the technologies and
skills required to customise ArcPad to develop a tailored
mobile application integrated with a database. We recommend
that you refer to ESRI’s website for further details
about ArcPad Application Builder.
back to top
ArcPad
Customisation
ArcPad
development may be approached in varying degrees depending on
the level of customisation required. Most ArcPad applications
are developed for capturing or updating data in the field. This
is a fairly straightforward process when all the attribute data
is held in a shapefile. The creation of the forms is primarily
a GUI driven process in which the user drags controls, for example
textboxes or drop down lists onto a form.
However
more often, the data that is being updated resides in external
databases that may be linked to a spatial layer. To update data
in an external database like a Dbase file or an Access database,
you would need to create an ArcPad applet and link a VBScript
file to it. The VBScript file contains the information required
to link the spatial data to an external database. You need to
be familiar with VBScript in order to develop ArcPad applets.
VBScript is a scripting language and is released by Microsoft.
The following sections describe how you customise data-entry
forms and create ArcPad applets to link to external databases
Figure
1
back to top
Customising
Data-entry Forms:
Creating
custom data entry forms for shapefiles will require editing the APL
file. The APL file is an ArcPad layer definition file containing numerous
properties which dictate how that layer file is displayed, any scale
dependencies, labelling options etc. A data entry form is stored in
this layer definition. This means that each time a feature is selected
for edit in ArcPad, the form associated with that layer will be displayed.
Information forms can also be defined within an APL file, eg attribute
data can be formatted to display in a particular layout. Editing an
APL file is ArcPad customisation in its most basic form.
APL files may be edited using ArcPad Studio, a text editing
application like WordPad or an XML editor. When creating edit
or information forms in APL files it is better to use ArcPad
Studio as it provides a user-friendly interface for arranging
form layouts, adding controls and events. However, I find
it much simpler to make symbology edits in a text editor.
You can copy and paste symbology definitions and modify values
much more effectively, eg to create a hatch symbol for an
attribute value = “critical” in which the hatch
colour is black, the background colour is red and the outline
is grey you would issue the following statement:
Figure
2
You can then copy and paste this code for other values in
the layer and change the colour and hatch definitions.
Figure
3: An APL file being edited in ArcPad Studio
Figure
4: The same APL file viewed in WordPad
Writing ArcPad Applets to Link to
External Databases:
If your ArcPad application requires data to be edited outside
of a layer, eg in an external database, you would need to
create an ArcPad applet. An ArcPad applet has a .APA extension
and contains definitions of toolbars, buttons, and forms in
an ArcPad application. An APA file is usually also associated
with a VBScript file with a .VBS extension. The VBScript file
may contain procedures to validate your data or to perform
database inserts, updates or deletes.
Figure
5: A typical ArcPad applet containing toolbars, forms and
a VBScript file
A tip when using ArcPad Studio: When creating drop down lists,
a more flexible option is to create Dbase files with the drop
down values. This means that a user can update the Dbase file
without needing to edit the code itself.
back to top
Connecting
to an External Database
ArcPad
provides the ability to update data held in shapefiles or in external
databases on the mobile device. In many cases the business data in an
organisation is held separately to the spatial data with keys linking
the two. There are a number of formats for storing the external data
on a mobile device, eg DBASE files, Pocket Access or SQLServer CE.
If
the corporate or desktop database is Microsoft Access, you can copy
it to your mobile and regularly synchronise it to download corporate
updates onto the mobile and/ or upload updates from the mobile to the
desktop. The synchronisation can be set-up using Microsoft ActiveSynch
so that it automatically occurs when the mobile is parked in the desktop
cradle.
When a Microsoft Access database is copied to a mobile device,
it is automatically converted to Pocket Access with a .cdb
extension. Windows CE does not have any software for viewing
Pocket Access databases. You need to install third party software
to be able to do this. When coupled with an ArcPad applet,
a VBScript file can open a connection to a Pocket Access database
and navigate through the records in a table. The first item
to check is whether ADOCE is installed on the device. ADOCE
is an abbreviation for "Microsoft ActiveX Data Objects for
the Windows CE operating system". It contains objects for
connecting to and updating a database. If it is not you can
download it from the MSDN site hosted by Microsoft by looking
up Windows CE downloads. The next is to determine what version
of ADOCE is installed. There are two versions available 3.0
and 3.1. Once you have established this you need to provide
a connection string eg.
Figure
6
As you can see in the example VBScript, all variables are
defined as variant. Line 5 in the above piece of code creates
a recordset object. Line 6 opens the recordset based on the
SQL expression. The numbers on the line specify the type of
cursor that is opened and the type of lock placed on the data
respectively. In this case a keyset cursor (1) and an optimistic
lock (3).
back to top
Summary
As with all application development, it is important to have
a clear understanding of what is to be achieved by the product.
ArcPad development is not difficult; however it is important
that tools or products are designed with the field crew and
their operational practices in mind. One of the chief reasons
for a product failing is if it is not developed in consultation
with the end-users. At Spatial Vision, we have considerable
experience in the application development path for mobile
applications and can advise you and recommend an appropriate
development strategy.
back to top
Copyright © Spatial Vision, Wednesday, 7-April-2004
|