Home > Archive > Programming with dBASE > December 2005 > rowset multiple filters









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author rowset multiple filters
Moses Hanna

2005-12-03, 3:23 am

Hi,
I have a rowset filtered to a specific criteria.
I want to add another filter to the existing filter and keep the old filter
criteria together with the new criteria
let us say that I have a rowset filtered on date and I want to add filter on
amounts. When I want to apply the amount filter, I don't know if there is a
filter in the rowset or not and (if there is what the filter is or how to
add the new filter to it)
Any help please?


Michael Nuwer [dBVIPS]

2005-12-03, 7:23 am

Moses Hanna wrote:
> Hi,
> I have a rowset filtered to a specific criteria.
> I want to add another filter to the existing filter and keep the old filter
> criteria together with the new criteria
> let us say that I have a rowset filtered on date and I want to add filter on
> amounts. When I want to apply the amount filter, I don't know if there is a
> filter in the rowset or not and (if there is what the filter is or how to
> add the new filter to it)
> Any help please?
>
>


The form below may be of some help.

** END HEADER -- do not remove this line
//
// Generated on 12/03/2005
//
parameter bModal
local f
f = new testMForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class testMForm of FORM
with (this)
height = 16.0
left = 31.1429
top = 8.1364
width = 59.4286
text = ""
endwith

this.DBASESAMPLES1 = new DATABASE()
this.DBASESAMPLES1.parent = this
with (this.DBASESAMPLES1)
left = 17.0
top = 12.5
databaseName = "DBASESAMPLES"
active = true
endwith

this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 17.0
top = 12.5
database = form.dbasesamples1
sql = "select * from fish.dbf"
active = true
endwith

this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.fish1.rowset
columns["Column1"] = new GRIDCOLUMN(form.GRID1)
columns["Column1"].dataLink = form.fish1.rowset.fields["id"]
columns["Column1"].editorType = 1 // EntryField
columns["Column1"].width = 15.7143
columns["Column2"] = new GRIDCOLUMN(form.GRID1)
columns["Column2"].dataLink = form.fish1.rowset.fields["name"]
columns["Column2"].width = 42.8571
with (columns["Column1"].headingControl)
value = "ID"
endwith

with (columns["Column2"].headingControl)
value = "Name"
endwith

height = 7.0
left = 3.0
top = 6.5
width = 55.0
endwith

this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
height = 1.0
left = 6.0
top = 1.5
width = 17.0
value = "1"
endwith

this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_O
NCLICK
height = 1.0909
left = 24.0
top = 1.5
width = 15.2857
text = "Set first filter"
endwith

this.ENTRYFIELD2 = new ENTRYFIELD(this)
with (this.ENTRYFIELD2)
height = 1.0
left = 6.0
top = 4.0
width = 17.0
value = "A"
endwith

this.PUSHBUTTON2 = new PUSHBUTTON(this)
with (this.PUSHBUTTON2)
onClick = class::PUSHBUTTON2_O
NCLICK
height = 1.0909
left = 24.0
top = 4.0
width = 15.2857
text = "Set second filter"
endwith

this.TEXTLABEL1 = new TEXTLABEL(this)
with (this.TEXTLABEL1)
height = 1.0
left = 6.0
top = 0.5
width = 17.0
text = "ID value 1 - 10"
endwith

this.TEXTLABEL2 = new TEXTLABEL(this)
with (this.TEXTLABEL2)
height = 1.0
left = 6.0
top = 3.0
width = 17.0
text = "Name value A - Z"
endwith

this.rowset = this.fish1.rowset

function PUSHBUTTON1_onClick
form.rowset.filter = [id=>]+form.entryfield1.value
return

function PUSHBUTTON2_onClick
cCurrentFilter = form.rowset.filter
form.rowset.filter = cCurrentFilter + ;
[and name => ']+form.entryfield2.value +[']
return

endclass
Moses Hanna

2005-12-03, 8:23 pm

Thanks Michael, this is what I wanted
Moses

"Michael Nuwer [dBVIPS]" <nuwermj@yahoo.com> wrote in message
news:s%23hpuTA%23FHA
.1520@news-server...
> Moses Hanna wrote:
>
> The form below may be of some help.
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 12/03/2005
> //
> parameter bModal
> local f
> f = new testMForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class testMForm of FORM
> with (this)
> height = 16.0
> left = 31.1429
> top = 8.1364
> width = 59.4286
> text = ""
> endwith
>
> this.DBASESAMPLES1 = new DATABASE()
> this.DBASESAMPLES1.parent = this
> with (this.DBASESAMPLES1)
> left = 17.0
> top = 12.5
> databaseName = "DBASESAMPLES"
> active = true
> endwith
>
> this.FISH1 = new QUERY()
> this.FISH1.parent = this
> with (this.FISH1)
> left = 17.0
> top = 12.5
> database = form.dbasesamples1
> sql = "select * from fish.dbf"
> active = true
> endwith
>
> this.GRID1 = new GRID(this)
> with (this.GRID1)
> dataLink = form.fish1.rowset
> columns["Column1"] = new GRIDCOLUMN(form.GRID1)
> columns["Column1"].dataLink = form.fish1.rowset.fields["id"]
> columns["Column1"].editorType = 1 // EntryField
> columns["Column1"].width = 15.7143
> columns["Column2"] = new GRIDCOLUMN(form.GRID1)
> columns["Column2"].dataLink = form.fish1.rowset.fields["name"]
> columns["Column2"].width = 42.8571
> with (columns["Column1"].headingControl)
> value = "ID"
> endwith
>
> with (columns["Column2"].headingControl)
> value = "Name"
> endwith
>
> height = 7.0
> left = 3.0
> top = 6.5
> width = 55.0
> endwith
>
> this.ENTRYFIELD1 = new ENTRYFIELD(this)
> with (this.ENTRYFIELD1)
> height = 1.0
> left = 6.0
> top = 1.5
> width = 17.0
> value = "1"
> endwith
>
> this.PUSHBUTTON1 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON1)
> onClick = class::PUSHBUTTON1_O
NCLICK
> height = 1.0909
> left = 24.0
> top = 1.5
> width = 15.2857
> text = "Set first filter"
> endwith
>
> this.ENTRYFIELD2 = new ENTRYFIELD(this)
> with (this.ENTRYFIELD2)
> height = 1.0
> left = 6.0
> top = 4.0
> width = 17.0
> value = "A"
> endwith
>
> this.PUSHBUTTON2 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON2)
> onClick = class::PUSHBUTTON2_O
NCLICK
> height = 1.0909
> left = 24.0
> top = 4.0
> width = 15.2857
> text = "Set second filter"
> endwith
>
> this.TEXTLABEL1 = new TEXTLABEL(this)
> with (this.TEXTLABEL1)
> height = 1.0
> left = 6.0
> top = 0.5
> width = 17.0
> text = "ID value 1 - 10"
> endwith
>
> this.TEXTLABEL2 = new TEXTLABEL(this)
> with (this.TEXTLABEL2)
> height = 1.0
> left = 6.0
> top = 3.0
> width = 17.0
> text = "Name value A - Z"
> endwith
>
> this.rowset = this.fish1.rowset
>
> function PUSHBUTTON1_onClick
> form.rowset.filter = [id=>]+form.entryfield1.value
> return
>
> function PUSHBUTTON2_onClick
> cCurrentFilter = form.rowset.filter
> form.rowset.filter = cCurrentFilter + ;
> [and name => ']+form.entryfield2.value +[']
> return
>
> endclass



Dinesh Chauhan

2005-12-03, 8:23 pm

Hi Michael

How sorting with combining two indexes on fly.

Dinesh Chauhan
fiji Islands


"Michael Nuwer [dBVIPS]" <nuwermj@yahoo.com> wrote in message
news:s%23hpuTA%23FHA
.1520@news-server...
> Moses Hanna wrote:
>
> The form below may be of some help.
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 12/03/2005
> //
> parameter bModal
> local f
> f = new testMForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class testMForm of FORM
> with (this)
> height = 16.0
> left = 31.1429
> top = 8.1364
> width = 59.4286
> text = ""
> endwith
>
> this.DBASESAMPLES1 = new DATABASE()
> this.DBASESAMPLES1.parent = this
> with (this.DBASESAMPLES1)
> left = 17.0
> top = 12.5
> databaseName = "DBASESAMPLES"
> active = true
> endwith
>
> this.FISH1 = new QUERY()
> this.FISH1.parent = this
> with (this.FISH1)
> left = 17.0
> top = 12.5
> database = form.dbasesamples1
> sql = "select * from fish.dbf"
> active = true
> endwith
>
> this.GRID1 = new GRID(this)
> with (this.GRID1)
> dataLink = form.fish1.rowset
> columns["Column1"] = new GRIDCOLUMN(form.GRID1)
> columns["Column1"].dataLink = form.fish1.rowset.fields["id"]
> columns["Column1"].editorType = 1 // EntryField
> columns["Column1"].width = 15.7143
> columns["Column2"] = new GRIDCOLUMN(form.GRID1)
> columns["Column2"].dataLink = form.fish1.rowset.fields["name"]
> columns["Column2"].width = 42.8571
> with (columns["Column1"].headingControl)
> value = "ID"
> endwith
>
> with (columns["Column2"].headingControl)
> value = "Name"
> endwith
>
> height = 7.0
> left = 3.0
> top = 6.5
> width = 55.0
> endwith
>
> this.ENTRYFIELD1 = new ENTRYFIELD(this)
> with (this.ENTRYFIELD1)
> height = 1.0
> left = 6.0
> top = 1.5
> width = 17.0
> value = "1"
> endwith
>
> this.PUSHBUTTON1 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON1)
> onClick = class::PUSHBUTTON1_O
NCLICK
> height = 1.0909
> left = 24.0
> top = 1.5
> width = 15.2857
> text = "Set first filter"
> endwith
>
> this.ENTRYFIELD2 = new ENTRYFIELD(this)
> with (this.ENTRYFIELD2)
> height = 1.0
> left = 6.0
> top = 4.0
> width = 17.0
> value = "A"
> endwith
>
> this.PUSHBUTTON2 = new PUSHBUTTON(this)
> with (this.PUSHBUTTON2)
> onClick = class::PUSHBUTTON2_O
NCLICK
> height = 1.0909
> left = 24.0
> top = 4.0
> width = 15.2857
> text = "Set second filter"
> endwith
>
> this.TEXTLABEL1 = new TEXTLABEL(this)
> with (this.TEXTLABEL1)
> height = 1.0
> left = 6.0
> top = 0.5
> width = 17.0
> text = "ID value 1 - 10"
> endwith
>
> this.TEXTLABEL2 = new TEXTLABEL(this)
> with (this.TEXTLABEL2)
> height = 1.0
> left = 6.0
> top = 3.0
> width = 17.0
> text = "Name value A - Z"
> endwith
>
> this.rowset = this.fish1.rowset
>
> function PUSHBUTTON1_onClick
> form.rowset.filter = [id=>]+form.entryfield1.value
> return
>
> function PUSHBUTTON2_onClick
> cCurrentFilter = form.rowset.filter
> form.rowset.filter = cCurrentFilter + ;
> [and name => ']+form.entryfield2.value +[']
> return
>
> endclass



Bruce Beacham

2005-12-04, 7:23 am

Dinesh Chauhan wrote:
> Hi Michael
>
> How sorting with combining two indexes on fly.


Make a third indes on the fly combining the two expressions. After
all, how would you have the system cope with things like DESCENDING and
UNIQUE in either of the first indexes?

You could restate your sql statement using an ORDER BY clause.


Bruce Beacham
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com