When you add a database connection to your portal, you do not have give all users access to all of your data. You can filter data on a per user basis (so users only see what you want them to see).
A database connection filter consists of three elements:
When a filter is applied to your database, it will return all the rows that match the filter's criteria.
For example, this is a filter that returns all the rows from a database where the column 'Client name' equals "Thomas Officer":
Does this 3 dropdown interface look familiar? It's the Expression Editor, the same mechanism you use to create conditional logic.
This is the essential question to creating a database connection filter. In most cases, you will want Portal users to see their data and only their data. For this, the best approach is the use the `Portal Client ID` which you can read about below.
There are two ways to filter database connection data: (1) a generic filter that applies to everyone who joins your Portal; and (2) an individual filter that applies only to a specific user.
A generic filter applies to everyone who joins your portal. This is the most common type of filter and it's quite powerful.
You add a generic filter on the portal configuration page after you click "View permissions" for your database connection:
An individual filter only applies to a specific portal user. This is not a very common type of filter.
You apply an individual filter either when you manually add a user or after a user has joined your portal. In either case, you use the Edit Client modal to apply an individual filter:
Every portal user has a unique `Portal Client ID`. You can use the Portal Client ID to filter your database connection data so that a user sees their data and only their data in your portal.
Let's assume you've already made an app and that this app includes a 'send data' function on one of its blocks such that it creates rows inside your database. You want to add this app to your portal and you want to add a database connection so that portal users can view their own data. Here is how you can create a database connection filter with`Portal Clients IDs` that does exactly that:
This is the column you will reference in your database connection filter. This column will contain the `Portal Client ID`, so you might as well label it "Portal Client ID."
Go to the 'send data' function inside your app. Add a param for the new "Portal Client ID" column you added to your database then select 'Portal Client ID' as the value you want to send over:
This will be a simple filter with what looks like only two parts:
Now, Portal users who run this app (and thereby generate rows of data) will only see their data in your database connection.