Add, edit, import and export records
Add, edit, and delete data source records in Fliplet Studio, and bring many records in or out by copying and pasting or with code.
A data source is a table of data your software stores in Fliplet, with named columns and one record per row. You can add, change, and delete records in Fliplet Studio, and copy and paste or use code to bring many in or out.
This page applies to the Data Sources manager in Fliplet Studio, and to screen code that uses the Fliplet JavaScript SDK. Fliplet Studio has no file import or export, so there's no CSV upload or download. To move many records, use pasting, copying, or code.
Before you start
- The data source must already exist. To make one, see Create and configure a Data Source.
- You need write permission on the data source, or the save fails.
- A save writes to the data source through the Fliplet API, and it has no publish step. A data source set to Online only is read through Fliplet's servers. One set to Available offline syncs automatically in the background when updates are available.
> [!WARNING] > On a data source that published software uses, Studio shows this warning: "Modifying data while live users are accessing the app may overwrite data. We recommend using admin screens within the app to modify data safely." After 5 minutes, the warning changes to say that app users or other Studio users may have changed some data, and it adds a link to reload the latest version. Reloading drops unsaved changes without asking.
Open the records
- Select Data Sources in the project sidebar.
- Select the name of the data source.
The data source opens on the Entries tab. Row 1 holds the column names, and each row after it is a record. All records load into one scrolling grid, followed by 40 empty rows and 10 empty columns. To search the grid, use Find.
A data source with no records and no columns opens with 2 rows of demo data in Column 1 and Column 2.
[SCREENSHOT: the Entries tab with column names in row 1 and the toolbar]
Add a record
- Select a cell in the first empty row.
- Enter a value in each column you need.
- Select Save changes [UNVERIFIED: label from code, because the button only appears after a change].
Changes aren't stored until you save, and Save changes appears once something has changed.
To place a record between others, select a cell in a row, then select Insert row before or Insert row after. A new row added while a column is sorted reloads in the data source's own order, and Studio shows a message for 5 seconds.
A value entered in a column with no name gets a generated name such as Column (1). When you save, empty rows are dropped, and a generated Column (1) style column with no values is removed.
Edit a record
- Select the cell.
- Enter the new value.
- Select Save changes.
To undo, press Ctrl + Z. To redo, press Ctrl + Y or Ctrl + Shift + Z. On a Mac, use ⌘ in place of Ctrl.
A cell holding a valid JSON array or object is saved as that list or object. A number stays as the text you entered. Text that isn't valid JSON has spaces at either end removed when saved. For how to choose a shape for each value, see Design columns and data shapes.
Delete a record
> [!WARNING] > Saving a delete removes the record from the data source. Restore on an earlier version in Version history brings it back, but replaces the data source's entire contents. Copy to new data source on the same menu creates a separate data source from that version instead. Entries larger than 50KB are excluded from each version snapshot.
Delete row acts on one continuous run of rows, so delete separate rows one run at a time. It isn't blocked on row 1, so keep the selection off the column names.
- Select the rows to delete, as one continuous run.
- Select Delete row.
- Select Save changes.
Import records by pasting
Pasting is how you bring many records into Fliplet Studio from a spreadsheet. Check these points before you copy:
- Columns line up by position, not by name. Pasted values fill the columns from the selected cell rightward, so order your spreadsheet columns to match first.
- Pasted values overwrite the cells they land on, so select the first empty row to add records.
- To set column names as well, paste the heading row into row 1. A name already in use gets a number added.
- The Paste toolbar button doesn't paste. It opens the Copying and pasting dialog, which lists the keyboard shortcuts.
- Copy the cells in your spreadsheet app.
- Select the cell in the grid where the first pasted value should go.
- Press Ctrl + V (⌘ + V on a Mac).
- Select Save changes.
Your plan can limit how many entries you can store. If a save would go past that limit, only the new records that fit are added and the save still succeeds, so check the count afterwards. If none fit, the save fails.
Export records by copying
Copying is how you take records out of Fliplet Studio. Pressing Ctrl + A on a cell that has data selects only the block around it. The block stops at the first empty cell in that row and in the block's first column, with no message, so records after a gap are left out. An empty cell among the records acts like a cell with data.
Pressing Ctrl + A in the spare empty rows after the records selects the whole grid, including row 1 and the spare rows and columns. The grid copies up to 1,000 columns at a time, and anything wider is cut off with no message.
- Select a cell in the empty rows after the records, at least 1 row clear of the last record.
- Press Ctrl + A (⌘ + A on a Mac).
- Press Ctrl + C (⌘ + C on a Mac).
- Paste into your spreadsheet app.
- Compare the row count with Entries on the top row of Version history, leaving out the row of column names.
Copied cells are tab-separated. Copy in the toolbar copies the selected cells too.
Import or export with code
Screen code connects with Fliplet.DataSources.connect(dataSourceId). This example adds 2 records and keeps the existing ones:
Fliplet.DataSources.connect(123).then(function (connection) {
return connection.append([
{ Name: 'Alice', Department: 'Sales' },
{ Name: 'Bob', Department: 'Finance' }
]);
});
Keys in the records that aren't columns yet become new columns.
| Method | What it does |
|---|---|
connection.append(entries) | Adds an array of records and keeps the existing ones. |
connection.insert(data) | Adds one record. |
connection.update(id, data) | Changes one record. |
connection.removeById(id) | Deletes one record. |
connection.find() | Reads records, each with an id and a data object holding its columns. |
For every parameter, see Fliplet.DataSources.
> [!WARNING] > connection.replaceWith(entries) deletes every existing record and writes the new ones. connection.commit() with no delete array and no append: true removes the records it doesn't list.
connection.import() exists, but the API route it calls reads rows from a JSON entries list and doesn't read a file, so sending a file adds no records. The SDK has no export method. To get a file, read records with find() and build the file in your own code.
If a data source has security rules, they're checked on writes from your software's users. They can be skipped for a signed-in Studio user, so a write that passes for you can be refused for a real user. Test as a real user of your software. To set the rules, see Secure Data Sources.
Check it worked
After a save, Studio shows "All changes saved!" [UNVERIFIED: message from code, because it only appears after a save] next to the data source name, and the grid reloads from the data source.
- Select Version history.
- Read the top row, which describes the current version.
Entries and Columns on that row show the record and column counts.
If something goes wrong
After a failed save, the grid reloads the stored records, so your unsaved edits have to be made again. Keep your spreadsheet until a save succeeds. Going back to the list of data sources or switching tabs with unsaved changes makes Studio ask you to confirm first.
These 3 save messages reach you in an error alert that shows the API's message:
- "Your role does not allow writing to this data source." [UNVERIFIED: message from code, because it only appears after a refused save] You don't have write permission. The Studio user permissions tab holds the data source's list of users.
- "The value in the column Email is already in use. Please use a different value." [UNVERIFIED: message from code, because it only appears after a refused save] The named column must hold unique values, so change the repeated value.
- "This data source was changed somewhere else (columns renamed or deleted: Email). Reload it to see the latest version, then make your changes again." [UNVERIFIED: message from code, because it only appears after a refused save] A column changed since you opened the data source.
If the records can't be read, Studio writes this on the Entries tab: "Access denied. Please review your security settings if you want to access this data source." [UNVERIFIED: message from code, and where it appears wasn't seen live]
See also
- How to use Data Sources: the parent guide to creating a data source and using its records.
- Design columns and data shapes: name columns and choose how values are stored.
- Fliplet.DataSources: the full SDK reference.
- Secure Data Sources: security rules on who can read and write records.
- Review and restore app versions: go back to an earlier version.