| Sample FormInstance template | 
In Fleet, you can define mobile forms that drivers fill out using a separate app, such as WorkPlan.
The purpose of this tutorial is to show you the relationship between the form templates you define in Fleet, the answers a driver enters in a mobile app, and what you can retrieve in TDE using the FormInstance table.
This topic contains the following sections:
 Defining a form template in Fleet
Defining a form template in FleetThe first step is to define a form template in Fleet. This example shows a Customer Satisfaction Survey that is split into two sections, Customer Information and Survey. The form contains a variety of form element Types.
|  Tip | 
|---|
| For more information about how to define form templates, see the Telogis® Fleet™ documentation. | 
Form definition in the Form Builder:



Form Preview:

 Filling out a form in WorkPlan
Filling out a form in WorkPlanOnce the form template is saved and made available to drivers, they can fill out the form. The example below shows a form that was filled out and submitted in WorkPlan.

 Retrieving a form instance in TDE
Retrieving a form instance in TDEIn some cases, a driver can save multiple versions of a form before submitting it. Each version of the form can be retrieved as a single form instance.
The template below retrieves all form instances saved or submitted between a start time and end time.
[Template] TemplateVersion = 1.0 TableID = FormInstance-1.0 TemplateName = RetrieveFormInstances Intent = Retrieve StructuredData = true # Required to retrieve a Map object, like the Values column Format = JSON [User] StartTime(Timestamp) = "" # Variables set by query string EndTime(Timestamp) = "" [Filter] SubmissionTime = Between(StartTime,EndTime) # Returns all form instances submitted between a start and end time [Output] Id = Input.Id DriverId = Input.DriverId Status = Input.Status SubmissionTime = Input.SubmissionTime Values = Input.Values
In this case, the retrieved results include a single instance of the form that the driver submitted. Note the following about the retrieved results:
The results retrieved from TDE match the answers the driver submitted in WorkPlan.
{
   "RetrieveFormInstances":{
      "TableEntry":[
         {
            "Status":"Submitted",
            "Values":{
               "3":{
                  "Id":"3",
                  "Path":[
                     "Customer Information"
                  ],
                  "Name":"Account Number",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"12345-6"
               },
               "4":{
                  "Id":"4",
                  "Path":[
                     "Customer Information"
                  ],
                  "Name":"Customer Name",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"Susan Smith"
               },
               "5":{
                  "Id":"5",
                  "Path":[
                     "Customer Information"
                  ],
                  "Name":"Title",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"Mrs."
               },
               "6":{
                  "Id":"6",
                  "Path":[
                     "Customer Information"
                  ],
                  "Name":"Account Status",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"Active"
               },
               "7":{
                  "Id":"7",
                  "Path":[
                     "Customer Information"
                  ],
                  "Name":"Add to Mailing List",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"True"
               },
               "8":{
                  "Id":"8",
                  "Path":[
                     "Customer Information"
                  ],
                  "Name":"Location",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"30.397541046142578, -97.7296142578125"
               },
               "10":{
                  "Id":"10",
                  "Path":[
                     "Customer Information"
                  ],
                  "Name":"Customer Photo",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"12d29b9e-399c-4b39-8dbb-9b3b24c223ba"
               },
               "13":{
                  "Id":"13",
                  "Path":[
                     "Survey"
                  ],
                  "Name":"Overall, how would you rate the service you received today?",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"The service was great"
               },
               "15":{
                  "Id":"15",
                  "Path":[
                     "Survey"
                  ],
                  "Name":"Value for money",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"Excellent"
               },
               "16":{
                  "Id":"16",
                  "Path":[
                     "Survey"
                  ],
                  "Name":"Quality of service",
                  "Type":"522d49a7-02d7-4c60-9f83-fb456e627c5e",
                  "Value":"Good"
               }
            },
            "SubmissionTime":"11/12/2015 9:46:30 PM",
            "Id":"d7e0f729-aa09-4672-a746-2e080f323c12",
            "DriverId":"1182692462"
         }
      ]
   }
}