filtering a list vfp
Posted on 2014-10-22
HI: I am writing a window purchase order system in vfp. The components I have grouped in codes in a table called tips.dbf.
So I have say 'CLR', 'PAT' 'SOF', for Glass, 'SPA',"SWS' "WRM' for spacer bar etc. A list on a form displays all of these codes .When you select a code from the list (say CLR) a grid is populated with all the components in that code. Works great. However there are a lot of codes.
So these codes are themselves grouped by type (in a second field in the table) - so all glass related groups are given a group'1'; all spacer related components are group '2', etc.
I would like to be able to filter the list so that if somebody wanted to order a glass component, only the codes in that group are visible. Thus if you want to order glass, click a button and the list only displays those codes in group 1.
I have this in a button:
SET FILTER TO group = 1
Which kind of works until I select from the list at which point the list becomes readonly, some codes disappear, or other odd things occur. And I often (not always!) get a message 'thisform can only be used within a method'
This is the code when I click on the list:
'SET FILTER TO orderbase.Type = Thisform.lIST1.Value
where order base is the table of components , reading in grid1.
I am obviously dead wrong here - anybody know the dead right way?
And I recognise that somebody may want to reset the filter to a different group so deleting from table 'tips' is a no go!