Refreshing Data using a Question Attribute

Apply a Refresh Data Source Expression attribute to a data-driven form element - such as a data grid or multiple choice question. This lets you control when its cached data should be refreshed.

Implementation:

  1. Open an existing model.
  2. Create a data source.
  3. Assign the data source to your model's question. Depending on the type of question you want to map to your data source, refer to Implementing a Data-driven Response List or Implementing a Data Grid, respectively.
  4. In the Definition panel, right-click the intended question.
  5. Click Attributes, and assign the Refresh Data Source Expression attribute to it.
  6. Switch to the Value panel.
  7. Write an expression in the Attribute Value field, so when it's evaluated each time a postback occurs on the form containing the question, and if it's result is True, the corresponding Cached Item will be refreshed.

When the Refresh Data Source Expression attribute is used with a Data Source Connect Expression attribute, this can precisely control how and when new data is retrieved, helping your application run more efficiently. For more information about these attributes, refer to Appendix: Attribute Types.

  1. Click OK.

Since KnowledgeKube prevents each cached item from being refreshed more than once during a single postback, there is no need to add this type of attribute to multiple form elements that rely on the same cached item. Instead, add the attribute to the first element that uses the cached item, so all subsequent elements can make use of the data after it has been refreshed.