Makeen transform after being used for some time may accumulate lots of data in the database. This may impact performance specifically in cases where submitted data is required to be viewed on a mobile device. These are special types of forms where the same form is being used to submit multiple times, each time with added information or more filled fields. It is also possible that the same form is filled by multiple users therefore form submitted by one user needs to be seen by another user on its mobile device. This requires downloading of data from server to other user devices.
However, downloading all data on a mobile device will result in inefficient utilization of resources, therefore it is important to download on mobile device only data that is relevant in order to save space. Relevant data may be the last 100 records or data of last one week or so and data older than that may not be required. To cater such requirements a field is introduced in a connector setting to define an expression to download data only matching criterion defined in the expression.
To define the filters:
1) Login to Studio
2) On the left menu select Connections
3) On the connector press the wheel button
4) Select the Entities tab
5) On the right-hand side under Details select Info tab
6) Scroll down and where field will be visible
7) Enter value in the field (possible values explained below) and press Save all entities
8) Open the app and put app code, it will download only the data which matches this criterion. Also if getdata trigger is used in a form then it will also fetch data as per the defined criterion. However, if getdata trigger has defined filters then the filter defined in getdata trigger will have precedence over filter defined here in the connector.
Possible values in the above field along with their use cases are:
- Bring records which were modified in last xx days:> WHERE datepicker1 >= ( CURDATE() - INTERVAL 5 DAY )
- Bring records created between Date A and Date B:> WHERE datepicker1 BETWEEN str_to_date('2018-11-06','%Y-%m-%d') AND str_to_date('2018-11-14','%Y-%m-%d')
- Bring records that belong to a specific User:> WHERE user1 = 'Sami'
- Bring records that belong to a specific department:> WHERE autocomplete_department = 'Computer Science'
- Bring last 100 recent records:> WHERE user1 = 'Sami' ORDER BY str_to_date(datetimepicker1,'%Y-%m-%d') DESC LIMIT 2
- Bring records where status is In Progress or Completed:> WHERE progress = 'Completed'
The above examples are actually where part of a query to filter records from the database.