The ArcPad Team Blog

Unofficial stuff from the team behind the World's leading mobile GIS platform

Saturday, July 18, 2009

ArcPad Login Form



Overview:

A common field data collection requirement is to automatically store the field worker's name in an attribute. This allows captured/edited features to be traced back to the field worker responsible for the captured/edited features. This sample applet demonstrates one approach to supporting this requirement.

The applet consists of a login form with the following behavior:
  • When ArcPad starts, the user is presented with a login form
  • The field user can select his/her name from the list of valid users
  • If the field user refuses to login, ArcPad will exit
  • The selected name is stored in an user property that can be retrieved from any script

To customize for your project:
  • Replace the included Logo.jpg with your own Logo.jpg file
  • Replace the included UserNames.dbf with your own UserNames.dbf file

To retrieve the selected user name in a script:

Dim selectedUser
selectedUser = Application.UserProperties("LoggedInEmployee")

For example, if your layer has an attribute called EMPLOYEE, you can use the following code in the OnLoad event of the layer's Edit Form:

Dim pForm
Set pForm = ThisEvent.Object

If (2 = pForm.Mode Or 3 = pForm.Mode) Then
   pForm.Fields("EMPLOYEE").Value = Application.UserProperties("LoggedInEmployee")

End If


Set pForm = Nothing



To deploy the applet:
Copy the applet files (Login.apa, Login.vbs, Logo.jpg, UserNames.dbf) to the ArcPad applets folder and start ArcPad.

Download this sample from ArcScripts at: http://arcscripts.esri.com/details.asp?dbid=16477

11 Comments:

  • At Tuesday, July 21, 2009 8:05:00 pm, Anonymous Anonymous said…

    HI,

    Great idea. Was looking for something like this for some time now, the login part works. But storing the user name in a table aint working. Could you confirm the script is valid for the onload (Form Properties (ArcPAd 8)):

    Dim pForm
    Set pForm = ThisEvent.Object

    If (2 = pForm.Mode Or 3 = pForm.Mode) Then
    pForm.Fields("EMPLOYEE").Value = Application.UserProperties("LoggedInUser")
    End If

    Set pForm = Nothing


    kind regards,

    Luc

     
  • At Saturday, July 25, 2009 1:54:00 am, Blogger Craig Greenwald said…

    I updated the ArcScripts description with this additional information that should help you:

    Important note: When using the retrieved user name to write to a field value in an edit form, use one of the following techniques:

    - If you are writing the value to a field that is hidden (i.e. no associated control shown in the edit form), set the Field value directly:
    pForm.Fields("EMPLOYEE").Value =
    Application.UserProperties("LoggedInEmployee")

    - If you are writing the value to a field that is linked to a control on the form, set the control value:
    pForm.Pages("PAGE1").Controls("EMPLOYEE").Value =
    Application.UserProperties("LoggedInEmployee")

    I also re-uploaded the Login.vbs file on ArcScripts to correctly use Application.UserProperties("LoggedInEmployee") instead of Application.UserProperties("LoggedInUser").

    Hopefully this solves your issue.

     
  • At Friday, August 21, 2009 5:48:00 am, Blogger Stace said…

    You guys really need to put a email link of some sort on the Blog page. Skype doesn't cut it.

     
  • At Monday, November 02, 2009 8:50:00 pm, Anonymous Almar said…

    Great Applet. However I am not able to edit the provided UserNames.dbf or add my own values using another table. Is the dbf table of a certain software version? I am working with ArcGIS9.2.

     
  • At Monday, December 07, 2009 11:47:00 am, Blogger poipoi said…

    You should put a search on your blog too. Because we can search the web, the news or the maps, but not your blog...

    I'm looking for some information of any kind on the Form Wizard applet. It doesn't seem to work here for me (ArcPad 7.1).

    The wizard goes through with no trouble, and reload the shapelayer all right, but when I try to create a new point in my layer, the form that appears is the common one, not the one created with the form wizard...

     
  • At Monday, December 07, 2009 12:03:00 pm, Blogger Marika said…

    to search the arcpad team blog, use the blogger search box int he top left hand corner of the page (i use it all the time).

    the best place to ask specific questions is the arcpad discussion forum http://forums.esri.com/forums.asp?c=34

    The ArcPad Login form SHOULD work with ArcPad 7.1, if your still having trouble, please upload a sample of your data and/or screenshot of your problem to the forum.

     
  • At Tuesday, January 19, 2010 10:07:00 am, Blogger softech said…

    Interesting… I might try some of this on my blog, too. It’s quite interesting how you sometimes stop being innovative and just go for an accepted solution without actually trying to improve it… you make a couple of good points.

    part time worker

     
  • At Thursday, April 12, 2012 12:47:00 am, Blogger Roy said…

    This comment has been removed by the author.

     
  • At Wednesday, April 25, 2012 5:08:00 am, Blogger Roy said…

    Can you use this method on a control that is filled using a domain? I have a list of values in a drop-down menu populated by a GDB domain, and I've been unable to get the user-name to copy into the user-name control in my form.

     
  • At Thursday, November 15, 2012 10:22:00 pm, Blogger G Bass said…

    Hi,

    Is is possible to adapt this to store the login info directly into several attribute fields in the axf?

    Am currently trying but its slow progress.

    In ancticipation

     
  • At Wednesday, November 28, 2012 2:29:00 am, Blogger G Bass said…

    I have managed to apply this apa/vbs to add 3 more pertinent fields to each feature class I use for survey, although it is inconsistent e.g. it works wholly for some, partially for others and not all for most.
    I have followed a set procedure each time to ensure controlled conditions but this if out-foxing me so far.
    Any suggestions as to what the issue may be?

     

Post a Comment

<< Home