PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WEBDEV 2024 → Search any string in a table
Search any string in a table
Started by JoseM, Oct., 30 2009 4:52 PM - 1 reply
Posted on October, 30 2009 - 4:52 PM
Is there any way when I click on the magnifying glass in a table can do a search for any string in the column? Alternatively, another way of doing the same search.

Thanks
Posted on May, 30 2017 - 4:52 PM
Yes...I wanted a "search" field outside of my table to use as a record "locator"...basically working the same as clicking on the hourglass in the LastName column in my table and then entering a search name...but I got tired of hitting the hourglass then entering the name, etc.

I used a standard edit control, added a "Clear/All" button to negate the search and a "Search" button (which I later hid/skipped.)





On my search entry field (EDT_SearchField) I changed the GUI, Right Click to "press" the Search button. This allowed me to enter any search characters I wanted in the EDT_SearchField and press the right mouse button to execute the search without having to move and select the "Search" button..

After experimenting I then added this code to the "Whenever modifying EDT_SearchName:

[code:wl]

Whenever modifying EDT_SearchName
// on "change" input right mouse key
SetFocus(WIN_Table_dbName.COL_LastName)
SendKey("{RIGHTBTN}",WIN_Table_dbName.EDT_SearchName)

In my example I have a window with a table displayed with a column named "COL_LastName." I search the COL_LastName for any matching LastNames that begin with the character/character sequence I entry into the "EDT_SearchName.,"

Each time I enter a key in the EDT_SearchName, the COL_LastName is incrementally searched. If I enter the letter "e", the first LastName beginning with "e" is brought to the top of the table.

If I continue and hit the "t" key, the COL_LastName is then incremented to show the first LastName beginning with "et," etc.

The search is not case sensitive..."e" is the same as "E"..."t" is the same as "T."