RunDataSource

RunDataSource

RunDataSource Use Examples

Basic RunDataSource Use

In this example we are going to be looking at a pair of drop down lists. What we want to achieve is that when the user selects an option from the Item Category list, the Items list beside it should automatically update to show only the items included in that category.

All Items

Item Categories

Only Fluids

First we create both fields. The Item Category list just has options to select ‘Audio Technology’ or ‘Fluids’. The Items list is being loaded from the datasource ‘ItemSource’ shown in the image. Now we switch the AutoPostBack property of the ItemCategory to on (Yes). You can see in the image we have added a process to the ItemCategory field.

 In this process we simply have the RunDataSource service that contains the ID for the ‘ItemSource’ datasource.

Effectively when the user changes the selection on the ItemCategory drop down list, this will trigger a postback and run the ‘ItemSource’ datasource. Inside this datasource we are checking for all the values where the category column contains ‘Audio Technology’ or ‘Fluids’. This is what is received from the ItemCategory field when the postback runs. Hence we get the effect of the Items list being filtered on the selection made in ItemCategory.

In the above image if you look at the Basic properties at the bottom right corner. You will see the property IgnoreBlanks/Empty Value has been set to ‘True’. This way when nothing has been selected in the first drop down, all the Items will be listed in the second drop down without any filters. If you want the functionality to be such that nothing can be selected unless something from the ItemCategory has been chosen, we can set the IgnoreBlanks to ‘False’. Setting it to ‘False’ will run the query with an equal to _Blank_ filter which should get back an empty drop down list.