When there is a combo box in a screen and you start typing the returned list contains all records that have the written character. But how to do it so that only the values that start with this character are returned? You have to use serverside filtering with a like
filter.
Start with creating the filter. Go to the entity and right click on the field that you want to have filtered in this way. Select Actions
> Create (Like) Filter With Parameter
.
The filter with parameter will be created. It might be useful to rename the parameter to “parString” if you will use it in more filters.
Now you have to make sure that the values are returned even if you have written just a part of the value. For that delete the parName
and instead right click on the Right
and select New
> Function Call
. Select the Concat
function. As the Strings
for the function add first a Parameter Reference
to the newly created parameter and then a Data Constant Reference
to the constant _wildcard
. That will add the percent character to the text for the SQL search. Since the Concat
function takes the strings alphabetically, adding numbers before the string name is the best way to get the correct order for the function. The result should look like this.
If you have more values in your ListDisplayMember
, you can repeat the process for another field and created a third filter with a LogicalOr
function and both previous filters as the Arguments
.
Now open your lookup and find the data structure used in the List
part. Open it (double click on the small document icon) and add the created filter. Then return to the lookup and reference it in the ListMethod
. Change IsFilteredServerside
to True
and fill the ServersideFilterPrameter
with the filter parameter name (you can with the exact name of the parameter when you right click on the filter set name in the data structure and select Actions
> Show SQL
).
Now the work is done, you can also optionally add a sort set to alphabetically sort the results.