|
Home > Archive > Programming with dBASE > December 2005 > "Filter" Option?
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]
|
|
| Bosco Wilson 2005-12-23, 11:23 am |
| Im trying to find a solution to a problem, and find myself stumbling along
being new to dBase. I have a form where I am trying to display certain jobs
for a certain client. I dont want to display all jobs, but only the jobs
from that certain client. I have set up a data module linking the
client.clientid to the job.clientid. But I cannot seem to figure out how to
filter these records. I see a "Filter" option under the rowset, but what is
its use? Tried using SQL but no luck. It is asking for a "Build String".
What exactly is it asking for? Is this even what I am looking for? Thanks
for any help and have a Merry Christmas!
| |
| Ken Mayer [dBVIPS] 2005-12-23, 1:23 pm |
| Bosco Wilson wrote:
> Im trying to find a solution to a problem, and find myself stumbling along
> being new to dBase. I have a form where I am trying to display certain jobs
> for a certain client. I dont want to display all jobs, but only the jobs
> from that certain client. I have set up a data module linking the
> client.clientid to the job.clientid. But I cannot seem to figure out how to
> filter these records. I see a "Filter" option under the rowset, but what is
> its use? Tried using SQL but no luck. It is asking for a "Build String".
> What exactly is it asking for? Is this even what I am looking for? Thanks
> for any help and have a Merry Christmas!
This kind of thing can get complicated quickly. The rowset has a filter
property that can be used to filter data. The results have to return a
true or false value.
You may want to get my book:
http://www.goldenstag.net/dbase/dBASEBook.htm
Which will help you get going developing an application, and explaining
how things work. You can also find things in the dBASE Knowledgebase,
and a dBASE tutorial at the dataBI website ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Michael Nuwer [dBVIPS] 2005-12-23, 1:23 pm |
| Bosco Wilson wrote:
> Im trying to find a solution to a problem, and find myself stumbling along
> being new to dBase. I have a form where I am trying to display certain jobs
> for a certain client. I dont want to display all jobs, but only the jobs
> from that certain client. I have set up a data module linking the
> client.clientid to the job.clientid. But I cannot seem to figure out how to
> filter these records. I see a "Filter" option under the rowset, but what is
> its use? Tried using SQL but no luck. It is asking for a "Build String".
> What exactly is it asking for? Is this even what I am looking for? Thanks
> for any help and have a Merry Christmas!
>
>
Maybe something like the following will get you started:
qClient.rowset.filter = [clientid = 'TheValue']
qJob.rowset.filter = [FieldName > 'minValue' And FieldName < 'maxValue']
| |
| Bosco Wilson 2005-12-23, 8:23 pm |
| Thanks for the tip, and I'll check the book out for sure.
Bosco
"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:3UeClw%23BGHA.1300@news-server...
> Bosco Wilson wrote:
>
> This kind of thing can get complicated quickly. The rowset has a filter
> property that can be used to filter data. The results have to return a
> true or false value.
>
> You may want to get my book:
>
> http://www.goldenstag.net/dbase/dBASEBook.htm
>
> Which will help you get going developing an application, and explaining
> how things work. You can also find things in the dBASE Knowledgebase, and
> a dBASE tutorial at the dataBI website ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| Bosco Wilson 2005-12-23, 8:23 pm |
| Sort of off topic, but why are there no (or not many) dbase books on the
market? I went to Borders today to find a book, and did not see one on
dbase. I was under the assumption that it was widely used, of course I've
been wrong before.
I ordered your book from Amazon Ken, the link you gave would not accept my
CC for some reason. Looking forward to reading it.
Bosco
"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:3UeClw%23BGHA.1300@news-server...
> Bosco Wilson wrote:
>
> This kind of thing can get complicated quickly. The rowset has a filter
> property that can be used to filter data. The results have to return a
> true or false value.
>
> You may want to get my book:
>
> http://www.goldenstag.net/dbase/dBASEBook.htm
>
> Which will help you get going developing an application, and explaining
> how things work. You can also find things in the dBASE Knowledgebase, and
> a dBASE tutorial at the dataBI website ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| David Stone 2005-12-24, 3:23 am |
| Bosco Wilson wrote:
> Sort of off topic, but why are there no (or not many) dbase books on the
> market? I went to Borders today to find a book, and did not see one on
> dbase. I was under the assumption that it was widely used, of course I've
> been wrong before.
Hi Bosco, dBASE is very widely used---there are people all over the world that
use it. It's just that there aren't quite as many people using it in each of
those widely-separated places as we'd like there to be. This leads to reluctance
amongst authors to write dBASE-related books. They tend instead to write for
flash-in-the-pan dev't tools de jour, like .net and stuff. Ho hum. We prefer
books written for love rather than for money anyway. ;-)
David
| |
| Robert Bravery 2005-12-24, 7:23 am |
| Hi,
If you have youre relation set correctly the jobs will be filtered per
client
It looks like you are linking the clientid in the client table to the client
id in the job table, which should give you a one to many link. That is for
every client you display n jobs
You could set up two grids, one to navigate each client, and the other to
show the jobs associated with that client
That way as the user navigates to each client the it displays their jobs
In order to use the filter property, you would have to knwo the filter to
use, that you would have to get from the user. Either the user types the
filter in or he gets the filter from a selection, either way you build your
filter like a sql selection
The following uses the contax database and alias, it uses contacts and
appointments, one contact many appointments, similar to what you want to
achieve
** END HEADER -- do not remove this line
//
// Generated on 24/12/2005
//
parameter bModal
local f
f = new tesone2nForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class tesone2nForm of FORM
//set procedure to :Samples:\Contax\tes
toneton.dmd additive
with (this)
height = 14.7727
left = 13.2857
top = 7.3182
width = 84.0
text = ""
endwith
this. TESTONETONDATAMODULE
1 = new TESTONETONDATAMODULE
()
this. TESTONETONDATAMODULE
1.parent = this
with (this. TESTONETONDATAMODULE
1)
left = 67.5714
top = 0.3636
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form. testonetondatamodule
1.appoints1.rowset
columns["Column1"] = new GRIDCOLUMN(form.GRID1)
columns["Column1"].dataLink =
form. testonetondatamodule
1.appoints1.rowset.fields["with whom"]
columns["Column1"].editorType = 1 // EntryField
columns["Column1"].width = 15.0
columns["Column2"] = new GRIDCOLUMN(form.GRID1)
columns["Column2"].dataLink =
form. testonetondatamodule
1.appoints1.rowset.fields["where"]
columns["Column2"].editorType = 1 // EntryField
columns["Column2"].width = 20.0
columns["Column3"] = new GRIDCOLUMN(form.GRID1)
columns["Column3"].dataLink =
form. testonetondatamodule
1.appoints1.rowset.fields["descrip"]
columns["Column3"].editorType = 5 // Editor
columns["Column3"].width = 28.5714
columns["Column4"] = new GRIDCOLUMN(form.GRID1)
columns["Column4"].dataLink =
form. testonetondatamodule
1.appoints1.rowset.fields["time"]
columns["Column4"].width = 10.0
with (columns["Column1"].headingControl)
value = "With Whom"
endwith
with (columns["Column2"].headingControl)
value = "Where"
endwith
with (columns["Column3"].headingControl)
value = "descrip"
endwith
with (columns["Column4"].headingControl)
value = "time"
endwith
height = 8.1818
left = 2.1429
top = 6.0909
width = 78.4286
endwith
this.GRID2 = new GRID(this)
with (this.GRID2)
dataLink = form. testonetondatamodule
1.contacts1.rowset
columns["Column1"] = new GRIDCOLUMN(form.GRID2)
columns["Column1"].dataLink =
form. testonetondatamodule
1.contacts1.rowset.fields["fullname"]
columns["Column1"].editorType = 1 // EntryField
columns["Column1"].width = 35.5714
with (columns["Column1"].headingControl)
value = "Fullname"
endwith
height = 5.4545
left = 1.7143
top = 0.2727
width = 41.5714
endwith
this.rowset = this. testonetondatamodule
1.contacts1.rowset
endclass
** END HEADER -- do not remove this line
//
// Generated on 24/12/2005
//
class testonetonDATAMODULE
of DATAMODULE
with (this)
left = -1.0
top = -1.0
endwith
this.CONTAX1 = new DATABASE()
this.CONTAX1.parent = this
with (this.CONTAX1)
left = 19.0
top = 135.0
databaseName = "CONTAX"
active = true
endwith
this.CONTACTS1 = new QUERY()
this.CONTACTS1.parent = this
with (this.CONTACTS1)
left = 133.0
top = 50.0
width = 114.0
height = 127.0
database = form.contax1
sql = 'Select * from "contacts.dbf"'
active = true
endwith
this.APPOINTS1 = new QUERY()
this.APPOINTS1.parent = this
with (this.APPOINTS1)
left = 317.0
top = 63.0
width = 120.0
height = 126.0
database = form.contax1
sql = 'Select * from "appoints.dbf"'
active = true
endwith
with (this.APPOINTS1.rowset)
indexName = "CONTACT"
masterRowset = form.contacts1.rowset
masterFields = "ContactKey"
endwith
endclass
Robert
"Bosco Wilson" <bosco@wilserv.net> wrote in message
news:yISH%23%239BGHA
.1300@news-server...
> Im trying to find a solution to a problem, and find myself stumbling along
> being new to dBase. I have a form where I am trying to display certain
jobs
> for a certain client. I dont want to display all jobs, but only the jobs
> from that certain client. I have set up a data module linking the
> client.clientid to the job.clientid. But I cannot seem to figure out how
to
> filter these records. I see a "Filter" option under the rowset, but what
is
> its use? Tried using SQL but no luck. It is asking for a "Build String".
> What exactly is it asking for? Is this even what I am looking for? Thanks
> for any help and have a Merry Christmas!
>
>
| |
| *Lysander* 2005-12-24, 7:23 am |
| In article <yISH##9BGHA.1300@news-server>, bosco@wilserv.net says...
> its use? Tried using SQL but no luck. It is asking for a "Build String".
If you are familiar with SQL, better do NOT use the filter-property too
widely, but instead build your SQL using a parametrized WHERE-clause.
This you will best do in the property "SQL" of your query-object.
QJobs.SQL = ;
"SELECT "+;
" * "+; // or field_a, field_b, field_c....
"FROM "+;
" Jobs "+;
"WHERE "+;
" Jobs.ID_Client = :IDC"
QJobs.Params["IDC"] = "---"
later, in your code, for example after a client-name has been entered in
an entryfield, and you found the ID by looking it up in a base-table,
you just have to refresh your rowset:
function PushButton1OnClick
// in this example Entryfield2 would contain the ID for the
// client-name in Entryfield 1
form.QJobs.Params["IDC"] = ltrim(rtrim(Form.Entryfield2.Value))
form.QJobs.Requery()
// Maybe you are showing the results in a GRID and would have
// to refresh the screen, depending on other settings
form.grid1.datalink = form.QJobs.rowset
Return
| |
| Ken Mayer [dBVIPS] 2005-12-27, 9:23 am |
| Bosco Wilson wrote:
> Sort of off topic, but why are there no (or not many) dbase books on the
> market? I went to Borders today to find a book, and did not see one on
> dbase. I was under the assumption that it was widely used, of course I've
> been wrong before.
It was more widely used until Borland (when they had it) decided to stop
marketing it ... and people lost track of it.
> CC for some reason. Looking forward to reading it.
Weird. Sorry to hear they wouldn't accept your card ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
|
|
|
|
|