Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: PowerBuilder
Expertise: Beginner
Feb 2, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Wild card searching using DataWindow

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

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.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date