Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search on more than one column in grid
Message
From
22/01/2015 03:53:05
 
 
To
21/01/2015 16:16:46
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01614032
Message ID:
01614062
Views:
39
Hi Dmitry

What I usually do (pseudo-code):
procedure form.load
thisForm.oFilter = create('empty')

procedure form.filterSet
lparameters filterCriterium, filterValue
addproperty(this.oFilter, filterCriterium, filterValue)
cFilter = '.T.'
for each filterCriterium in this.oFilter
  uFilter = eval('this.oFilter.' + m.filterCriterium)
  cFilter = m.cFilter +iif(isnull(m.uFilter);
   , '';
   , ' and ' + m.filterCriterium + ' = ' + cLitteral(m.uFilter); && cLitteral() makes a litteral out of any value - tell me if you need it
   )
endfor
set filter to &cFilter in this.grid.recordSource

procedure grid.init
for each column in this
  addproperty(header, oFilterCntl, <filter control such as texbox>)
  addproperty(this.oFilterCntl, <filter criterium>, .null.)
endfor

procedure header.click
this.oFilterCntl.visible = .T.

procedure oFilterCntl.Valid
thisForm.filterSet(this.filterCriterium, this.Value)
>Hi,
>
>I am thinking of how to implement the following functionality and looking for suggestions.
>
>Current Design:
>When a desktop application window with a grid is open, for example, List of Parts, user can click on the header of any column and make this a searchable column. The index tag is then set to the clicked column field and user can start typing into a Search text box. Where the program dynamically shows/looks for just the items matching the entry.
>
>Future Enhancement:
>I want the user to be able to click on the second (and possibly third) column (after they performed the search as in the step above). And allow user to narrow down the search by another column of the grid.
>
>I can add a Filter feature where user would specify all his/her query condition and then search the database and display the results. But I am hoping there is a way to make this work dynamic (just like searching on one column).
>
>TIA for any suggestions.
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform