Formotus forms support the ability of InfoPath forms to retrieve data through a data connection. The data connection can be to a SharePoint list or library, or to a SOAP or REST web service. This article explains how to create two different scenarios: normal query and persistent caching. Normal queries behave consistently with InfoPath; persistent caching deviates from InfoPath behavior to optimize for occasionally connected mobile devices.
A normal query retrieves data into your form, where it stays as long as the form is open. When the user closes the form the data is gone, and when a new draft is opened it does not have any data until the query is performed.
A normal query is performed when a query rule is triggered, as with a rule on a button. It can also be set to happen automatically when the form is opened, providing the device is online at that time.
Persistent caching retrieves data into your form more permanently, so that whenever the user opens a new draft thereafter the cached data is used. This kind of cached data cannot be updated automatically when the form opens, and it cannot be updated using a normal query rule.
Persistent caching can dramatically improve performance and reduce unnecessary data transfer for forms that don't need the data refreshed every time they are opened. A large list of part numbers and descriptions, for example, might only need to be updated a few times a year.
How to set normal query or persistent caching
When creating a data connection to retrieve data in InfoPath 2010 or 2013 there is a check box that reads “Store a copy of the data in the form template”. Mark this box to create a persistent cache or unmark it to create a normal query.
Note: Marking this box creates form behavior on the mobile device that is different than InfoPath form behavior. This is by design, to enable our customers to avoid large, slow and possibly expensive data transfers when they are not needed. The two differences in form behavior are:
- InfoPath will automatically update the cached data when it is online. Formotus forms will not.
- InfoPath will update the cached data with a normal query rule. Formotus forms will not.
How to set up a persistent data cache
Formotus uses a special action button in InfoPath called Update Form. The text on the button is important for it to work correctly because the button text identifies the data connection to update. Follow these steps to create a persistent caching scenario:
- Create a data connection with a name you want to see on a button. For example, name the data connection "List" if you want the button to read "Update List".
- Set the data connection to store a copy of the data in the form.
- Add a button to your form, assign it the action Update Form, and be sure to name it "Update <Dataconnection>", which would be "Update List" in the example above.
Note: You won’t see your Update Form button in the InfoPath preview mode unless you have a Web enabled form, but it will work on the device nonetheless.