Cache the Picker’s Data to Avoid Problems with Events and Actions

Given a SmartForm with the same item view attached to it three times, like rows: View A at top, View B in the center, and View C at bottom. Each view contains a series of controls, including a picker. Events on the view are wired such that the selections of the controls are recorded in a data label as each was made, So a dropdownlist control set to “I”, a radio button list with “am” selected, and a picker control set to “asleep” would give us a value of “I am asleep” in the data label.

I was seeing a peculiar behavior wherein the entire value of the data label in View A was being wiped out after the picker resolved, but the same combination of controls and values were working just fine in subsequent views. The same was also true if I skipped View A and used View B.

I spent quite a while troubleshooting and was able to resolve the problem by setting the picker to cache its data. By caching the data, the picker effectively loads when the view initializes, instead of loading at first use. This just-in-time loading was impacting the rule actions assigned to the picker’s changed event. It is also why I would see the behavior on the first view I used it on, but not on subsequent views.

To set a picker control to cache its data, select it on the SmartForm Designer and look at its properties at lower left. In the Data Source region, click the ellipses button to the right of the SmartObject field to bring up the Configure Data Source dialog. About 3/4 of the way down that dialog, under the Display settings, you should find a checkbox indented to align with the form fields above it. The label simply reads, “Cache the data.” Check the box and click OK to close the Configure Data Source dialog, then finish and check in the view or form.

The picker should now load its data in the form or view’s initialize event, allowing your event actions to proceed unimpeded.

Cache the Picker’s Data to Avoid Problems with Events and Actions

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s