Many DataSources require frequent editing. For instance, suppose you have a DataSource containing a list of customer names, addresses, and phone numbers. As you get new customers and lose some old ones, you will want to add or remove some of these customer records. If a customer moves to a different location or changes their phone number, you will want to edit the records. This article goes over how to do all of these things. In particular, we cover:
- Adding/Editing DataSource records individually
- Adding/Editing DataSource records in bulk
- Deleting DataSource records
- Indexing your DataSource
All of these actions can be done in the DataSource Editor. To access this screen, first open the DataSources List by selecting Manage DataSources from the More dropdown, then click the name of the DataSource you wish to edit.
You will see a list of your DataSource records, with the first column always designated as “Key”. Note that if your DataSource has many columns, they might not fit on the screen all at once; scroll right to see these additional columns.
Adding/Editing a single record
To add a single record, click the Create Row button at the top. A new row will appear above your existing DataSource rows. Enter all the column values, and click Create to add the new record to your DataSource.
To edit an existing record, simply find that record on the page and click it. The record will immediately become editable, as shown below. Update the record with new values and click Save.
Adding/Editing records in bulk
To add or edit multiple DataSource records, you have to import a CSV file. Build the CSV file just as you would when creating a new DataSource.
- If the Key column value in the CSV matches an existing Key in the DataSource, then the existing record will be updated with new column values from the CSV.
- If the Key column value in the CSV does not match an existing Key in the DataSource, then a new record will be created.
Once you finish constructing your CSV, click the Import CSV button at the top. In the Import CSV file dialog that appears, use the Browse button to select your CSV file from the file chooser. Next, choose the appropriate options:
- If your CSV file has a header row, check the CSV file has header row box. If this box is checked and your DataSource has default column names, the header row will be used to update the column names. If it is not checked — or if your DataSource already has non-default column names — then column names will remain as they are.
- If you wish to be able to use this DataSource when your mobile device is offline, check the Use Datasource Offline box. Database fields connected to your DataSource will now work properly even when you fill out a form while your mobile device is offline.
Finally click Create to complete the import and add/edit DataSource records.
To delete one or more records from your DataSource, use the checkboxes on the left to select the records you want to delete, then click the Delete Selected button at the top. Click Yes in the confirmation dialog box.
Indexing your DataSource
Indexing a DataSource on a particular column lets you use that column for data retrieval via a Database field in your form. See here for more on what this means.
To index a DataSource column, click the Set Indexes button at the top. You will see a dialog box listing all your column names with checkboxes next to them. Check the boxes next to the columns you want to index. You can index up to 5 columns in addition to the Key column, which is always indexed automatically.