(Please note that older articles might not render correctly in mobile view.)
Partitions are a filtering mechanism applied to large data sources in order to determine what rows of data are relevant to different users/groups. When using mobile forms, each user or group gets a different "partition" of the data set synced to their mobile devices, ensuring they have only the data that is relevant to them.
Organizations often have a very large master data set stored in or exported from their backend system. For example, a utility company might have a data source containing a list of all gas meters in Oregon. Having that full data set in one piece is meaningful and useful to the people who manage that data.
However, inspectors in the field are not traveling across the entirety of Oregon to inspect meters; they only inspect meters in one small region. Therefore, it's not useful for them to have access to the entire data set. Having the entire data set is resulting in slow reconcile times, and could lead to inspectors making a mistake and selecting a meter in the wrong region.
Data source partitions make it easy to provide those inspectors with only the meters for their region.
Benefits of Using Partitions
- Manage larger data sources without an impact on app performance: When a mobile device reconciles with ProntoForms, without partitions, it downloads the entire data source. When the data source is updated and a device reconciles, it downloads the entire data source again. Different mobile devices can store different amounts of data, and some older or lower performance devices may experience performance issues if the file is too large.
Partitions allow you to keep the data in one data source in the ProntoForms system, but divide up the data for mobile users so they experience the best app performance.
- Control access to data: Some data sources may contain data that should not be available to certain users. For example, a facilities management company has several customers, who each have multiple facilities that they maintain. Some subcontractors manage buildings for Customer A, while different subcontractors manage buildings for Customer B. For contractual reasons, the subcontractors who do work for Customer B are not allowed to see the data for Customer A.
Partitions allow you to still maintain all the data in one data set, but to restrict subcontractor access to only the relevant data within that set.
- Usability and Error Reduction: If users have access to a smaller set of data, they will find dropdown lists easier to search and use. They will also be less likely to make mistakes when presented with a smaller list of options.
- Mouse over the Manage Forms tab, confirm that you are in the desired FormSpace, and select Data Sources.
- Select the desired data source by clicking on its name..
- Mouse over the dropdown next to the data source name and select Create Partition.
Dynamic partitions divide the data source based on the mobile user's username/User ID or the user's Group Name/Group ID. As you add new users or groups, the partitions will automatically take effect for them.
This is the more commonly used kind of partition and is useful if you want to control every user/group's access to data.
Sample Data Source
Below is a relatively simple data source as viewed in a spreadsheet program; this will be used for all examples in this article.
A dynamic partition can be used to filter the data so that when "John Doe" is filling out a form on his mobile device and selects a "Customer" dropdown list, he only sees the customers in rows that have his name in them. With the same partition, "Jane Doe" can view only her customers.
Set up the Partition
- In the above screen, the column selected is "Rep"; this is where the value (Username) to partition by is listed.
- The field to match is "Username"; this tells the filtering mechanism to search for the mobile user's Username within the "Rep" column, and give the user access only to data in rows that contain their username in the "Rep" column.
For Field to Match, other options to select from are User ID, Group ID, and Group Name.
Regex partitions use Regular Expressions to manually partition the data source. You can set up multiple partitions, for individual users or individual groups. If a data source is not partitioned, all users with the correct formspace permissions will have access to the full data source.
This would be useful if most users are employees and can access all data, but a single group of subcontractors needs restricted access.
Sample Data Source
For example, using the data source below, a Regex partition can be used to filter the data so that when users in a particular group select a "Customer" dropdown list, they are shown only users in regions containing the word "Ontario."
Set up the Partition
- In the above screen, the column selected is "Region", as the regular expression will try to match data in this column.
- In order to link the filter only to a particular group, select Group as the Link Type. Other options are User and Everyone.
- Select the group to receive the filtered data.
- Enter your regular expression. Here we have entered ^.*Ontario.*$ to match any field containing the word "Ontario." Test your regex (External Link) before deploying it to a production environment.
Set up as above, the group "Demo Group" will see only customers located in Ontario (whether it be Western, Eastern or Central) in their customer list. Multiple partitions can be set for the same data source -- for example, a different partition can be made to show another group only customers located in "Western Canada."