Create and configure a Data Source
Create a data source in a Fliplet Studio project, name its columns, add a security rule, and choose offline availability.
A data source is a table of data that your project stores in Fliplet, with named columns and one row per record. People can read its records and add new ones. [UNVERIFIED: this sentence was reworded after the last verification check] This page shows you how to create one and get it ready for your project.
This page applies to projects in Fliplet Studio. [UNVERIFIED: which Studio roles can create a data source] [UNVERIFIED: whether your plan limits the number of data sources; the limit is skipped for some projects, and no source records which ones]
Before you start
- Open your project in Fliplet Studio. You create data sources from Data Sources in the project sidebar.
- A data source you create in a project is attached to that project.
- You get full permissions on a data source you create. They show as
crudqon the Studio user permissions tab.
Create the data source
- In your project, select Data Sources in the project sidebar.
- Select Create new data source.
- Enter a name in the Enter the name of your new Data Source prompt.
- Select OK.
The data source opens on the Entries tab.
The prompt accepts up to 255 characters. Spaces at the start and end of the name are removed, and so is any text in angle brackets. If you leave the name empty, you see this message:
You must enter a data source name
To rename a data source later, use Data source name on the Settings tab, which holds up to 48 characters. A rename is refused if another data source in the project has the same name, ignoring case:
Data source with the name 'Contacts' already exists in this app. Please rename it.
Name the columns
Row 1 of the Entries grid holds the column names. A new data source shows 2 demo rows under Column 1 and Column 2, with the value demo data. [UNVERIFIED: Studio UI, demo rows read from code only]
- Select the first cell in row 1.
- Enter the column name.
- Repeat for each column in row 1, moving along the row.
- Select a demo row.
- Select Delete row in the toolbar.
- Repeat for the other demo row.
- Select Save changes. [UNVERIFIED: Studio UI, this button on the Entries tab appears only after a change]
After the save, the status reads All changes saved! [UNVERIFIED: Studio UI, status text read from code only]
Use Insert column after and Delete column in the toolbar to add and remove columns. Column names follow these rules:
| Situation | What happens |
|---|---|
| You clear a column name | The column is named Column (n), where n is a number. |
| You repeat a column name | A number in parentheses is added, for example Name(3). |
| You enter a value under a column with no name | The column gets a generated name. |
A Column (n) column has no values when you save | The column is removed. |
| A column name is longer than 255 characters | The name is cut to 255 characters. |
To choose your columns, see Design columns and data shapes. To fill the data source, see Add, edit, import and export records.
Add a security rule
A new data source has no security rules, so requests that the rules apply to are refused until you add one. A request is allowed when any enabled rule that matches grants it. With no rules, the Security rules tab shows No security rules found and this message: "Apps will not be able to access this data source until security rules are added." [UNVERIFIED: Studio UI, message read from code only]
> [!CAUTION] > Security: All users has no login check. A rule that gives All users Write, Update or Delete lets anyone who reaches your project change its data.
- Select the Security rules tab.
- Select Add new rule.
- Select Create my own rule.
- Under Allow, select All users or Logged in users.
- Under Users can, select each operation they need.
- Select Add rule.
- Select Save & Apply. [UNVERIFIED: Studio UI, this button appears only after a rule is added]
The rule isn't stored until you select Save & Apply. The confirmation reads "Your changes have been applied to all affected apps." [UNVERIFIED: Studio UI, message read from code only]
[SCREENSHOT: the Add new security rule dialog with Allow, Users can and Applies to]
| Option | Value | What it does |
|---|---|---|
| Allow | All users | The default. The rule applies with no login check. |
| Allow | Logged in users | The rule applies to users who are logged in. |
| Users can | Read | Reads entries. |
| Users can | Write | Adds new entries. |
| Users can | Update | Changes entries. |
| Users can | Delete | Deletes entries. |
| Applies to | All projects | The default. The rule isn't limited by project. |
Add rule stays turned off until you select at least one operation under Users can. You can leave Include or exclude columns and Request data requirements empty for a rule that covers whole entries.
To limit a rule to specific users, a token or specific projects, or to limit its columns, see Secure Data Sources.
Add new rule also offers 5 pre-configured rules. Selecting one adds it at once and opens it for editing:
- All users can read gives All users Read.
- Logged in users can write gives Logged in users Write.
- Admins user types have full access and offline access
- Users can only retrieve some fields
- Users can only insert records if they provide their account ID
Choose offline availability
A new data source is Online only. A data source is left out of offline data if the security rules don't grant read access to the person requesting it.
| Option | Effect shown in Fliplet Studio |
|---|---|
| Available offline | Increases app size and syncs data automatically in the background when updates are available. Works without internet. |
| Online only | Keeps your app smaller but data requests must go through Fliplet's servers. Requires internet connection. |
- Select the Settings tab.
- Under Offline availability, select Available offline or Online only.
- Select Save changes.
The data source returns to the Entries tab.
Check it worked
- Select See all my project's data sources. The list shows your data source's ID and name.
- Select the data source's name. Entries shows your column names in row 1.
- Select the Security rules tab. Your rule is a row marked Enabled.
- Select the Settings tab. Offline availability shows the option you selected.
[UNVERIFIED: Studio UI, how to test a rule as one of your users, because no preview path was checked]
If it didn't work
A refused request shows the data source's name and the operation, which is read, write, update or delete:
The security rules for the Data Source "Contacts" do not allow this app to read data.
A request made with an app token shows this instead:
You are not allowed to read this data.
To fix the refusal, add a rule that grants that operation to those users, or select Edit on an existing rule, then select Save & Apply. [UNVERIFIED: Studio UI, this button appears only after a rule changes]
Rules are skipped for a Studio user outside preview, so data that loads while you edit in Fliplet Studio doesn't prove the rule works for your users. For other causes, see Data Source access and permission errors.
See also
- How to use Data Sources: the parent guide.
- Design columns and data shapes: choose your columns.
- Add, edit, import and export records: fill your data source.
- Secure Data Sources: use the other rule options.
- Data Source access and permission errors: work through refused requests.