Files can be attached to a template and pushed back to the database. The "File" field type allows filtering of only specific file type extensions to be attached to the template. For example, to filter for PDF, JPG, and TXT file types, select the File field type and in the filter section enter "pdf,jpg,txt" for the file extensions. The File field type allows a single file attachment or multiple files, by selecting the MultipleFiles checkbox.
Note: Collect Mobile is not currently able to preview/open the attached files in the mobile application.
Mapping for the file field type is through the "Files" table of a specific format (e.g., Files_v1 section of the EDGE format). Data mappings for the file field type can be used to link files to other fields or to rename files as they are pushed to the database. Data mapping for the file field type is performed in the Data Mapping window in Collect Enterprise.
In an example using the EDGE format, Files_v1 mapping can be linked to other tables in the EDGE format to create an association between the files being pushed and specific data in other tables. For instance, a photo of a well linked to Location_v1 associates the photo file with a particular well location (i.e., SYS_LOC_CODE).
When files and photos are pushed to the database from the Collect Mobile app, they are automatically assigned a GUID (Globally Unique Identifier) to ensure a unique file name. A GUID is a series of bytes in hexadecimal notation represented by characters ranging from 00 to ff (i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f). While this ensures uniqueness for file names, the file name has no connection to the content of the file. To have file names stored in the database that provide meaning as to what the file is, data mapping can be used to assign a specific file name instead of using a GUID.
When renaming the files, it is important to first remove the “key” from the two main key fields in the Files target format section: file_name and file_type. Unchecking the key fields ensures that the data mappings are processed after the new row is created in the database when the file(s) are being pushed.
For the file_name field of the Files format target table in the data mapping, set the Value property to create a unique name for the file for when it is sent to the database. In the image below, the file name that will be pushed to the database will be a concatenation of the name of the file as defined by the user in the field with a hyphen and a unique date and time stamp.
When using the file field type to push a single or multiple file(s) that are not photos, a zip package of the file(s) will be created. If multiple files are sent, the name of the zip package will be assigned based on first file read in the data mappings.
When sending photos and multiple files back, each field (multimage, drawing, file, etc.) should contain its own unique data mapping. Create a new mapping to the Files format table, uncheck the key fields, and assign a unique name (if desired) for each file/photo field.
Copyright © 2020 EarthSoft, Inc • Modified: 30 Mar 2020