Using the DataSource Defined in the View

DataSource instances that are defined in an AXVW view are created and cached by Web Central when the view is rendered. Workflow rules called by the view JavaScript code can obtain and use the cached DataSource instance. This allows the Add-In Managers to customize the DataSource properties (visible fields, restrictions, SQL queries) after the workflow rule Java code has been written and tested.

This also allows writing reusable workflow rules that can be invoked from different views and work with different data sources, as long as the WFR business logic is the same for these data sources.

To obtain the cached DataSource instance, use the factory method and provide the short view name and the DataSource ID within that view. These parameters can be hard-coded or passed in from the client:

DataSource ds = DataSourceFactory.loadDataSourceFromFile('ab-my-view.axvw', 'ds_wr');


The DataSource instance obtained from the cache can be used to access the database in the same way as if it were created programmatically. Because the DataSource Factory returns a copy of the cached DataSource and not the original, you can modify any property of the obtained DataSource before accessing the data.