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:
- Open an existing model.
- Create a data source.
- 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.
- In the Definition panel, right-click the intended question.
- Click Attributes, and assign the Refresh Data Source Expression attribute to it.
- Switch to the Value panel.
- 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.
- 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.