Documentation

(visionx)

Filter or Search multiple values

Translations of this page:

This is an old revision of the document!


A filter or search field makes it easy to search for the occurrence of a specific value within a table/list. If you want to search for multiple values in the same field, you need to use the Profiles and Filter AddOn. This allows convenient searches for multiple values. However, sometimes it would be helpful to enter multiple values in a single search field, which the standard search field does not support without source code modifications.

Here’s an example table:

The search field looks for a first name matching a specific value, such as John or J*.

However, if you enter multiple names, like John;Ma*, the search will not return results since no first name contains this text. But implementing this is quite simple with some lines of code:

filterFirstname.eventConfigureCustomCondition().addListener(new IFilterEditorListener() 
{
    @Override
    public void configureCustomCondition(FilterEditor pEditor) throws Throwable 
    {
        String sValue = (String)pEditor.getValue();
 
        if (sValue != null)
        {
            ICondition cond = new Or();
 
            for (String element : StringUtil.separateList(sValue, ";", true))
            {
                cond = cond.or(new Like(pEditor.getColumnName(), element));
            }
 
            pEditor.setCustomCondition(cond);
        }
        else
        {
            pEditor.setCustomCondition(null);
        }
    }
});

The Like search enables finding similar values. Wildcards can be defined using *. Searches can also be performed using Equals or other conditions.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information