|
||||||||||
|
|
Making a form for data & photo collection using a Treo camera
What you need
How it works
A few lines of script in the form design can be used to automatically select the most recent photo from a specific directory on your storage card and then attach that photo to an Image field on the form.
You prepare your form to receive a photo by setting some field values or by showing the relevant screens. Then, you leave Pendragon Forms and launch your camera application to take the photo. When you return to Pendragon Forms, your form uses the GETLASTFILE statement to locate the new photo that was taken, and the IMPORTFILE statement to attach the image to the form.
The photo is synchronized along with other Pendragon Forms data and stored in the data table as a long binary object.
Scripting: GETLASTFILE and IMPORTFILE statements The new scripting statement that makes this possible is called GETLASTFILE. Using this statement, the application looks for new images in the Pendragon folder on the card that were created after a specified time. getlastfile "/filepath" extension cutoff For example: getlastfile "/DCIM/Pendragon" jpg $[CaptureTime] This statement has three arguments: The first is the name of the folder on your card to scan for files. On a storage card, photos are typically in the DCIM folder. You will need to configure a "Pendragon" album on the storage card in the camera application itself. The second is the file extension that should be scanned for. Typically, this will be a jpg file. The third is the cutoff time. Images taken before this time will be ignored. The cutoff time would typically be stored in a DateTime field created for this purpose. The cutoff time can also be expressed as a single variable (e.g. buffer, result, temp) or as a constant equal to the number of seconds since 1/1/1904. For example: temp = now - 300 getlastfile "/DCIM/Pendragon" jpg temp
getlastfile "/DCIM/Pendragon" jpg 0
After executing this statement, the RESULT variable contains the pathname of the new file. If more than one image meets the search criteria, the filename of the newest file is returned.
An IMPORTFILE statement could be used to import the image file into a Pendragon Forms image field. For example, this script would place the name of file into Field 14 and then import that file into field 15: $14 = RESULT IMPORTFILE 15 $14
The IMPORTFILE statement is new in Pendragon Forms 5.0. Additional information is available on page 296 of the Pendragon Forms Reference Guide
Sample forms The TreoCamera.zip file contains two sample forms: TreoCamera5.pff and TreoCamera5Basic.pff. The TreoCamera5Basic.pff form demonstrates the process of setting the cutoff time parameter, retrieving the filename of your photo and importing the photo into your Pendragon Forms record. The TreoCamera5.pff form provides an example of a more robust photo capture form. This will display a preview of the image and allow you to confirm that you want to attach it. This allows you to preview new images without deleting a photo previously attached to a record. To use these forms, install the updated Forms 5.0 PRC file, and then import and install the TreoCamera5.pff and TreoCamera5Basic.pff files into Pendragon Forms. You can then freeze and distribute the test forms. To use the form, tap on the Capture button, take a picture, and then return to Pendragon Forms. The application looks for new images in the Pendragon folder on the card that were created after you clicked the Capture button. You will need to configure a "Pendragon" album on the storage card in the camera application itself. Tip: Assigning a hardware button to launch Pendragon Forms is a convenient way to switch applications.
Other Topics Creating an Access report (for bitmap images only) Creating an Access Report with a Photo Control (for jpeg images) This page may take a moment to load.
For more information Pendragon Forms Reference Guide: Chapter 17 Working with Images Recommended! (To download PDF documents, right-click on the link above and choose Save Target As...) Tutorial: Manually Selecting and Importing Photos Stored on the Card or Device Using JPEG images with Pendragon Forms PDA cameras, pictures and Pendragon Forms
© 2004 Pendragon Software Corporation. All rights reserved. Copyright and trademark information. |
|||||||||