Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incremental Search

Status
Not open for further replies.

astech

Programmer
Jul 25, 2000
59
ID
I have one from and one textbox and one grid.
how to filter grid with value that i input in textbox ?
 
refer to FAQ on tip below .

How to make an incremental search in Grid faq184-1214
 
Sorry, i mean how to show/filter only data that same with value input, not only go to the record that same.
 
Create a property in the Form.
then put code below in the textbox's interactive chage

Code:
SELECT table

IF NOT EMPTY(this.Value)
	thisform.test = ALLTRIM(this.Value)&&thisform.test is the property that i create
	SET FILTER TO picnum = thisform.test 
ELSE 
	SET FILTER TO 
ENDIF 

THISFORM.Refresh

I do recommend u do this carefully when u filter a big table it will become very slow.. Or u can try index on the field u wish to filter to make it faster. Refer RushMore on VFP help. to get full detail.
 
Error Happend !.
When i run the form as singgle form, it's work good.
But when i run as subform (do frmsearch), the data only show when it acctualy same with the search value.

eg.
* as singgle form.
when i type 'M' (without quote), the grid show all data where contain M in first.
* as Sub Form.
when i type 'M' (without quote), the grid not showing data where contain M in first,
but when i type 'MUMMY' (without quote), the grid showing data where MUMMY is a whole field data.

Where is my wrong ?
 
Got no idea how to solve it. But i think u can trace it out by using the Debugger built in VFP.


SELECT table

IF NOT EMPTY(this.Value) &&<---Put a break point here
thisform.test = ALLTRIM(this.Value)&&thisform.test is the property that i create
SET FILTER TO picnum = thisform.test
ELSE
SET FILTER TO
ENDIF


0. Put a break point as line above
1. Close the debugger.
2. run the form
3. type 2- 3 word in the text box.
4. start the debugger again.
5. type 1 more word..
6. Go to the debugger.
7. at the watch windows type
alias() &&<-- The result must be the table u try to filter
set(&quot;filter&quot;) && <-- Will show u the Filter sryteria.
thisform.test. &&<-- Check the value is it same as what u type

now u should able to find out the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top