Trace:
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
visionx:filter_mutliple_values [2025/06/16 15:11] admin created |
visionx:filter_mutliple_values [2025/06/16 15:14] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~NOTRANS~~ | ||
~~Title: Filter or Search multiple values ~~ | ~~Title: Filter or Search multiple values ~~ | ||
Line 10: | Line 9: | ||
The search field looks for a first name matching a specific value, such as //John// or //J*//. | 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 a bit of source code: | + | 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: |
- | <code java> filterFirstname.eventConfigureCustomCondition().addListener(new IFilterEditorListener() { @Override public void configureCustomCondition(FilterEditor pEditor) throws Throwable { String sValue = (String)pEditor.getValue(); | + | <code java> |
+ | 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(); | + | if (sValue != null) |
- | + | { | |
- | for (String element : StringUtil.separateList(sValue, ";", true)) { cond = cond.or(new Like(pEditor.getColumnName(), element)); } | + | ICondition cond = new Or(); |
- | + | ||
- | pEditor.setCustomCondition(cond); } else { pEditor.setCustomCondition(null); } } });</code> | + | for (String element : StringUtil.separateList(sValue, ";", true)) |
+ | { | ||
+ | cond = cond.or(new Like(pEditor.getColumnName(), element)); | ||
+ | } | ||
+ | |||
+ | pEditor.setCustomCondition(cond); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | pEditor.setCustomCondition(null); | ||
+ | } | ||
+ | } | ||
+ | });</code> | ||
The Like search enables finding similar values. Wildcards can be defined using *. Searches can also be performed using Equals or other [[https://www.sibvisions.com/files/jvx/current/api/jvx/rad/model/condition/package-summary.html|conditions]]. | The Like search enables finding similar values. Wildcards can be defined using *. Searches can also be performed using Equals or other [[https://www.sibvisions.com/files/jvx/current/api/jvx/rad/model/condition/package-summary.html|conditions]]. | ||