Dean L Covey
|
| Posted: 03/23/2005, 7:29 PM |
|
I have my search grid and everything works GREAT except I need to know how to utilize a search with wild cards
I want to type in my search box a* and get everything that starts with the letter 'A'.
Any ideas?
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 03/23/2005, 8:11 PM |
|
You can open the Data Source property/dialog of the grid, then modify the Where/Table parameter by changing the "Condition" to "begins with (like ...%)".
Here is the screenshot of that Where/Table parameter dialog: http://docs.codecharge.com/studio/html/UserGuide/Forms/ug285.png
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
peterr
Posts: 5971
|
| Posted: 03/23/2005, 8:20 PM |
|
Oops, I see that I misunderstood your question. If you want to allow users to enter wildcards then you may need to modify the Where statement dynamically via custom code.
But in simple scenarios at minimum this should work:
Change the Data Source Type of the grid from "Table" to "SQL" then modify or add the WHERE statement within your SQL like:
WHERE db_field_name LIKE '{s_field}'
Then create an SQL Parameter with such parameter:
Variable Name: s_field
Variable Type: Text
Parameter Source Name: (the name of your search field)
Parameter Source Type: URL
This should work as long as your users enter search criteria compatible with your database. Some databases may require (%) instead of (*) and then you'd need to instruct your users to enter a% instead of a*.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Dean L Covey
|
| Posted: 03/23/2005, 10:00 PM |
|
Which table are we talking about? I am assuming the second, the not search grid.
Also how does this work with multiple fields?
I am using ms-access. Should I be doing this through query instead?
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 03/24/2005, 12:55 AM |
|
We're talking about any Grid that you may have on a page.
You can apply the same logic to multiple fields. You would only need to be little familiar with SQL able to write the WHERE clause that uses the LIKE statements with whichever fiels you want.
You don't need to use queries for this unless you'd use a query otherwise.
Keep in mind that doing this through SQL is a simple and limited method. Another way would be to write some programming code that parses the user's search criteria and creates your WHERE clause dynamically. This is where possibly someone else could help you if anyone's done this.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Dean L Covey
|
| Posted: 03/24/2005, 11:07 AM |
|
I have it working without any wilcard. I changed the SQL to "Begin with" and seems to meet our needs for now. I'll mess with your suggestion later. I think I understand. Just not familiar enough to get my head around. The "Like % ..%" feature doesn't seem to allow wildcards with with ASP and Access. It seems to actuall look for the card itstelf.
I see why a query is not needed though.
|
|
|
 |