devxlogo

Wild card searching using DataWindow

Question:
I tried to place wild-card (e.g. ‘%Ken%’) for the searching of records in a DataWindow through QueryMode, but couldn’t get the result. Are there any other ways to do the searching?

Answer:
The best way to do searching in a DataWindow is by using the find command. The find command lets you embed most of the datawindow functions that you can normally use in an expression painter.

Therefore you can use two very powerful commands to achieve the result you are looking for. These are mainly POS and MATCH. With Pos you could say:

dw_1.Find( "Pos( name, 'ken' ) > 0", 1 , dw_1.RowCount() )

To match any case you can use:

dw_1.Find( "Pos( Lower( name ), 'ken' ) > 0", 1 , dw_1.RowCount() )

If you want to get very sophisticated, you can use the Match function which provides for wildcards, character ranges and many other features.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Five Early Architecture Decisions That Quietly Get Expensive

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.