Select to view content in your preferred language

How does the date and time gets saved in ArcPad?

4196
5
09-21-2010 04:28 PM
JoseSanchez
Frequent Contributor
Hi all,

My questions is are newbie questions related to Date and Timestamp fields:


  • Is there a way to declare a field that will be populated with the date and the time when the point gets created? Automatically populated?

  • ??? Do I need to add any background code in VB or VB.net to handle this field ?

  • ??? Does it work on the GPS device or only in my computer ?

  • ??? Does it work with dfb files or do I need a personal geodatabase?


Please advise
Tags (3)
0 Kudos
5 Replies
EricHajek1
Regular Contributor
Assuming that you have an editform for the points you're collecting, and a field of type "date" in the feature class you're using, you can simply put...

ThisEvent.Object.Fields("your date/time field name, include the quotes").value = Now

...into the "onunload" event of your form. It'll be totally out of sight / out of mind for the user, and you don't need to have a edit box or date box or anything on the actual form. It will work for files such as shapefile / GDB feature classes (whose editforms pop up when you edit a feature), but if you wanted to use a .dbf it gets more complicated.

Good luck,
Eric
0 Kudos
JoseSanchez
Frequent Contributor
Hi

Is there any manual or tutorial that explains how to add vbscript events to a form?

please advise
0 Kudos
by Anonymous User
Not applicable
Hi,

I use the Month/Day/Hour/Minute/Second to generate a unique ID for all new features in my applications. This is the code I use and call it from a custom, add new feature tool:

Dim tmpTemp
  tmpTemp = Right(String(4,48) & Year(Now()),4)
  tmpTemp = tmpTemp & Right(String(4,48) & Month(Now()),2)
  tmpTemp = tmpTemp & Right(String(4,48) & Day(Now()),2)
  tmpTemp = tmpTemp & Right(String(4,48) & Hour(Now()),2)
  tmpTemp = tmpTemp & Right(String(4,48) & Minute(Now()),2)
  tmpTemp = tmpTemp & Right(String(4,48) & Second(Now()),2)

Hope it helps.

Kyle
0 Kudos
JasonTrook
Deactivated User
Hi All,

I've having a problem auto-populating my field w/ a date/time.  It is a "date" data type and I put this in, as suggested earlier in this post:

onunload = ThisEvent.Object.Fields("RECORDDATE").value = Now

However, when I reopen the form the date field is still blank/unchecked.
I can get the info to display in a text box but I'd prefer to auto-populate my existing date field type instead.

Thanks,

Jason
0 Kudos
santiagoarango
Deactivated User
I just enter FormatDateTime(Now(),vbGeneralDate) for the default value in the Date field (in Arcpad Studio - Arcpad 8+). Date data types do not work (I can't figure it out anyway), and you must use a regular 'EDIT' box, and set required on (at least it's a good idea).

If you don't have Arcpad Studio -  open the APL file in a text editor (notepad or I use NoteTab Pro), and look for This sort of language:

<DATETIME name="NDATETIME" x="46" width="80" height="14"
defaultvalue="FormatDateTime(GPS.Properties( "UTC" ),vbGeneralDate)"
tooltip=""
tabstop="true"
border="true"
readonly="true"
field="NDATETIME"
allownulls="false"/>

Add the defaultvalue statement - and it should work!

You'll notice I used GPS time (which will be in Greenwich Mean Time - which is easily converted if you desire).  It prevents users from messing up by either not properly setting the field computers time - or setting it incorrectly.  To use the computer or system time - use this: FormatDateTime(Now(),vbGeneralDate) instead.  All sorts of formats are possible - just google the FormatDateTime function in Visual Basic (VB).

By the way - the Arcpad studio part of Arcpad is worth the money to upgrade!  Of course I think it always should have been included...  Once you get started you won't stop creating custom forms and menus, and buttons, and....  And using it will allow you to more easily learn VB (if you have some programming knowledge).


This really works man, thank you very much
0 Kudos