How is your experience with the OutSystems Community?
13
Views
3
Comments
Implement Custom Block-based Filtering in Dropdown Search/Ta? (e.g., split by hyphen)

Hello everyone,

I have a question about customizing the search behavior in the standard Dropdown Search / Tag widget in OutSystems 11.

My current issue:When I type "338" into a dropdown search/Tag, it returns options where "338" appears anywhere within the full label—for example, both 301-338-809-0 and 301-333-809-0 show up, because the substring "338" or similar sequences are found anywhere inside the label.

What I want:Instead of matching everywhere in the label text, I need the search to match only if one of the blocks separated by hyphens (-) exactly matches the search text.

Example:Given these dropdown options:

  • 301-338-809-0
  • 305-133-801-0
  • 301-333-809-0

If I type 338, only 301-338-809-0 should be shown.If I type 333, only 301-333-809-0 should be shown.

Is it possible to modify or override the default search/filter behavior for Dropdown in OutSystems 11 to support this block-based (exact match per segment) search?Or, has anyone already built or come across a solution for this kind of need?

Any guidance, ideas, or example implementations would be greatly appreciated!

Thank you!

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi,

please share a small independant oml with this already as a demo in it, that will considerably lower the threshold for people to help.

2023-09-06 07-26-35
Sudip Pal

Hi @Braham ayad 

Use Server-Side Dropdown and add your custom filter. Check the below post
we don’t want dropdown search to trim spaces | OutSystems

Thanks,

Sudip

2024-02-16 11-58-28
Sheikh Mohd Fahad

You can achieve this by enabling ServerSideSearch and handling the OnSearch event manually.

Then filter the list using:
 Index("-" + CurrentItem.Label + "-", "-" + SearchText + "-") <> -1

This makes the search match only exact hyphen-separated blocks.

Example:

  • 338 matches 301-338-809-0
  • 333 matches 301-333-809-0
  • 33 will not incorrectly match 338 

After filtering, assign the filtered list back to the Dropdown ItemList.
You can do this either server-side or fully client-side using ListFilter in the OnSearch action. No custom JavaScript needed.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.