1. In the Main Menu go to Layer | Create Layer | New GeoPackage Layer....
2. Click the Browse button
to go to your project folder and choose the GeoPackage from the previous section, in our case bangula_study_area.gpkg.
3. For Table name type Survey. For Geometry type choose Point. Make sure the projection is set to EPSG: 32736.
4.
Now we're going to add the attributes. Add the attributes like in the screenshot
below. Add them by using the Add to Fields List button.
5. Click OK when done.
6. A popup will ask you if you want to overwrite or add a new layer. Choose Add New Layer so it will be added to the GeoPackage.
The Input app will use the same styling as defined in QGIS. Let's create a point symbology.
9. For the first symbol layer make the Fill color transparent and the Stroke color black. Increase the Size to 4 mm and Stroke width to 1 mm For the second symbol layer choose a cross as marker symbol and choose Stroke color black. Increase the Size to 8 mm and Stroke width to 1 mm.
Make an attribute form using widgets
The next step is to design the attribute form using widgets.
10. Click right on the Survey layer and choose Properties...
11. In the Properties window go to the Attributes Form tab.
Here
we can design the form. We'll use the default Autogenerate option.
Under fields we see all attributes in the Survey layer.
12. Click on fid. On the right side of the window we can configure the widget. The value of fid is
assigned automatically by QGIS to GeoPackage layers and does not need to be edited by user.
Set the Widget type to Hidden to make it invisible in the form.
13. Click on Observation ID. Type for Alias Observation number. This is how it will appear on the form. Choose the Text Edit widget and check the Not null box and Enforce not null constraint under Constraints. This means that it is a mandatory field. Keep the other fields as default.
14. Click on Date. Type Date and time as Alias. Widget Type is automatically set to Date/Time. Change Widget Display to Custom and make it dd-MM-yyyy HH:mm:ss. Check the preview to see how it is formatted. Uncheck the box before Calendar popup. Under Defaults type as default value $now to have the current date/time automatically filled in.
15. Click on Observer. At Alias type Observer name. Choose the Text Edit widget and check the Not null box and Enforce not null constraint under Constraints. If you have a default observer you can type his/her name in single quotes under Defaults at Default value. Keep the other fields as default.
16. Click Picture. For Widget Type choose Attachment. Check the box for Relative paths. Under Integrated document viewer choose Image. At Constraints check the box before Not null.
17. The fields X coordinate and Y coordinate we can keep as default with the Text edit widget and no constraint.
18. Click Z. Set the Alias to Elevation. Keep the Text edit widget and no constraint.
19. For Type give the Alias Feature type. Set the Widget type to Value Map. Fill in the Value Map as the figure below. The user will get these items in a dropdown list and can choose from what is written in the Description column. The corresponding Value will be written to the attribute table. Under Constraints check Not Null and Enforce not null constraint.
20. For Depth type as Alias Depth to bottom (m). Keep Widget type as Text edit. We only want this field to be filled in for wells or boreholes. Therefore we add an Expression under Constraints:
"Type" = 'Wells' OR "Type" = 'Boreholes'
.
Check the box to Enforce expression constraint.