Demo Application - Truck Inspector

Resources

Introduction

The Truck Inspector demo details implementing a truck inspection record system, called Rent-A-Truck. With this application, inspections with markup may be made on devices by users, with the inspection records sent to a server database.

This tutorial will show you how to utilise various form controls, use data binding to save records, create synchronisation rules and create expressions.

Assumptions

This document assumes that the user knows how to create tables, forms and queries. For further help regarding these BrigthBuilder concepts, please refer to their chapters in the User Manual, or Tutorials exploring these features.

Application Definition

  1. Create a project and name it DemoRentATruck.

  2. Create the following table with the specifications shown:

  3. Create a query called qAllInspections that will return all inspection records, with the following specifications:

  4. Create a new Sync Rule SyncSendInspections with the following specifications:

  5. Create a form called Main that has the following components:

    Note: Set the form background colour to [255,255,255]. This property can be found on the form properties. bmpLogo is a bitmap.

  6. Create another form called Inspect. It has 4 tabs: Details, Visual, Notes, Sign. To add new tab, right click outside the form area, and select Add New Tabs.

    1. Details Tab

      • The radio buttons' component names are called rbTankEmpty, rbTank1_4, rbTank1_2, rbTank3_4, rbTankFull (change their value property to 0,1,2,3,4, respectively). The image shows their Caption value.

      • Staring with efID, assign the following tab orders: efID - 0, dtInspection - 1,

      • efRego - 2, efMake - 3, efModel - 4 and efMilage - 5).

      • Change the style property of dtInspection to Custom, and enter dd/MMM/yyyy in the Style-Custom Format.

    2. Visual Tab

      • The white area is a scribble (component name is sgnTruck), set the pen color to

      • Red [255,0,0] and pen Width to 2 on the scribble property. The yellow page is a

      • button (component name is button2, caption is C, set Bitmap to True and specify

      • the image path). In the same area as sgnTruck there is another control

      • bmpTruck that is a bitmap image of a truck.

    3. Notes Tab

      • This tab only consists of a single edit control. Enable the Multi-line and Scrollbar

      • – Vertical properties.

    4. Sign Tab

      • Set the tab order of efCustName to 6. sgnCust is a scribble.

  7. Go to the Data Binding tab of the Inspect form and modify according to the following:

    Note: Only the controls shown in the image above need to be included. There are other fields that do not need to be loaded or saved.

  8. While still in the Inspect Form, create the following expressions:

  9. On the Main Form, create an expression called Sync:

    Synchroniser.DisableAll()

    Synchroniser.EnableSyncRule("SyncSendInspections", true)

    Form.ShowSyncDialog(false)

  10. Go to Main form and do the following:

  11. Go to Inspect form and do the following:

  12. Assign the Main form to the Main Form Name property of the project.

Application Testing

Execute the project form BrightBuilder.

Click in Inspect to open the Inspection form.

Click on the New icon at the bottom to start a new inspection.

Enter the vehicle details and complete the rest of the inspection data. Click on the save icon at the bottom.

Close the form. To send the inspection records on the local database to the server click Send button on the initial menu screen.