Updating Data Source From A Form
Often you may want to allow the user to create and edit rows in one of your Data Sources.
This is supported on Aeros COLLECT by setting up a Form in the way described below.
Let’s assume you have a data source called "Projects", and you want to use a Form called "Project Editor" to add/update rows in the Projects data source.
- Open the Form designer for your Project Editor form, make sure you have an editable Draft/Test version.
- Ensure you have a Choices field on your Form, which is set to use the "Projects" data source.
- Tick on the "Create/Update Row" property on that field.
This instructs the Form to create/edit the selected row from your Choices field.
- Add some fields - one for each column that you want to allow to be edited on the Projects data source.
On each of these fields make sure you set the "Bind to Data Source Column" property to assign that field to be bound to the specified column.
This binding means that the selected row's value for the given column will be set into the field, and also any edits in the field will be written back to that column.
- To enable the creation of a new row in the data source, you must have a "dummy" row in your data source which has it's first column value set to 0.
This way the user can select this row from the list to add a new project.
The app is also coded to treat 0 value rows as being a new row, and it will auto-generate a 36 character unique key (a GUID) for the row to ensure uniqueness.
- We recommend you also set the displayable title column of this dummy row to be something like "Add new project" or something like this.
This will make the purpose of the dummy row clear to the user.
- If you want the dummy row to always be visible as an option on the Choices field, then set the Default Value property to 0 and tick on the Always Show Default Option property.
Once you have implemented the above, test out your Form to see the results.
Try selecting an existing row and editing it, and also try creating a new row.
The Projects data source will be automatically updated with the new row/edited row, both on device and then on the central data source on the web platform, once the form has been completed and uploaded.