Home > Forum > Data sources > Item list initialization – prevent data source query when filter value is empty

Item list initialization – prevent data source query when filter value is empty
0

I have an item list that is initialized from a data source and filtered by a form field (Customer/Group ID).
The problem is that when a new workflow instance is opened, this field is initially empty. Nevertheless, the item list initialization queries the data source. In my case this is a relatively slow external data source, causing an unnecessary delay of about 10 seconds.
What I actually need is:
- No data source query while the filter field is empty
- OnChange of the Customer/Group ID, initialize the item list
- The item list must store a snapshot, so a Data Table is not an option
For normal data source usage there are options to avoid querying on empty values, but I couldn't find anything similar for item list initialization.
Has anyone found a way to prevent the initial data source call, while still allowing the item list to be initialized later on demand?

In reply to: Jacek Wojnar

Hi
To trigger a initialization, you can use the `initialize` function when the field value changes (the "Style and behavior" tab)

Have you tried adding a condition like WHERE 'xxxx' != '' ?
(where `xxxx` is your `Customer/Group ID` from the form fields)

Hi,
yes, I already use the initialize function on field value change, and that part works as expected.
The problem occurs when opening a new workflow instance. To configure the data source, filter and column mapping for the item list, initialization has to be set to “On first step” (or “On every step”).
On initial form load, WEBCON evaluates/queries the configured data source even though the Customer/Group ID is still empty. Adding a condition such as WHERE '{Customer/Group ID}' != '' does not prevent the data source itself from being queried – it only results in no matching rows.
In my case the data source accesses an external system and the query itself takes about 10 seconds, so this causes an unnecessary delay when opening a new workflow.
What I am looking for is a way to not query the initialization data source at all when the filter value is empty, while still keeping the initialization configuration so I can trigger initialize later via the OnChange form rule.