Form filter using OPAL???

Form filter using OPAL???

Post by Jude Maghiran » Thu, 25 Jul 1996 04:00:00



OK, I give up.  I am trying to run a form filter with Object PAL but am
having surprisingly little luck.  Surprising because it seems like a
simple thing to do.  What I want is to display only records containing a
given value of "Recid#" in an open form.  The form is based on a data
model containing a table, e.g. "MyTable.DB".   I've been using code such
as the following:

method PushButton(var eventInfo Event)

var
        dynFltr DynArray[] AnyType
        frm Form
        tc TCursor
        fltrparm String
        tbl Table
endVar

tbl.attach("MyTable.db")

fltrparm="aaa"
dynFltr["Recid"]=fltrparm
tbl.setGenFilter(dynFltr)

endmethod

        The setGenFilter seems to work because if I do a tbl.cCount, it
returns the appropriate number(e.g. 3 of 10 records in the table have
Recid="aaa"). However, the resulting filtered data is in a TCursor object
that is not recognized by the form, i.e. the form still displays all 10
records. I tried using the dmAttach method to associate the TCursor
generated by setGenFilter to "MyTable.DB" which was successful (returned
"True") but the form itself was still displaying all the records in
"MyTable.DB" and not just the subset of records reflected by the filter.  
Can anyone shed light on what I'm missing?

Thanks in advance,
Jude Maghirang
*ia Health Quality Center

 
 
 

Form filter using OPAL???

Post by Michael Tylma » Thu, 25 Jul 1996 04:00:00


If anyone has an answer for Jude, perhaps you can cc: me as well
because I'm having a very similar problem:

FORM1 is a form that normally opens with a filter condition on one of
the fields (call it FORM1FIELD).

I would like to open FORM1 from FORM2 with the filter condition
removed.

The code in FORM2 should look something like this:
________________________________________________
var
  theform   Form
endvar

  theform.open("FORM1.FSL")
  theform.form1field.<<<<REMOVE FILTER CONDITION>>>>
_________________________________________________

Unfortunately, there doesn't seem to exist a UIO property for the
filter condition on a field in a form.

Can it be done?

Michael Tylman
__________________________________________________________
Jude Maghirang Wrote:

Quote:

> OK, I give up.  I am trying to run a form filter with Object PAL but am
> having surprisingly little luck.  Surprising because it seems like a
> simple thing to do.  What I want is to display only records containing a
> given value of "Recid#" in an open form.  The form is based on a data
> model containing a table, e.g. "MyTable.DB".   I've been using code such
> as the following:

> method PushButton(var eventInfo Event)

> var
>         dynFltr DynArray[] AnyType
>         frm Form
>         tc TCursor
>         fltrparm String
>         tbl Table
> endVar

> tbl.attach("MyTable.db")

> fltrparm="aaa"
> dynFltr["Recid"]=fltrparm
> tbl.setGenFilter(dynFltr)

> endmethod

>         The setGenFilter seems to work because if I do a tbl.cCount, it
> returns the appropriate number(e.g. 3 of 10 records in the table have
> Recid="aaa"). However, the resulting filtered data is in a TCursor object
> that is not recognized by the form, i.e. the form still displays all 10
> records. I tried using the dmAttach method to associate the TCursor
> generated by setGenFilter to "MyTable.DB" which was successful (returned
> "True") but the form itself was still displaying all the records in
> "MyTable.DB" and not just the subset of records reflected by the filter.
> Can anyone shed light on what I'm missing?

> Thanks in advance,
> Jude Maghirang
> *ia Health Quality Center


 
 
 

Form filter using OPAL???

Post by Gene Griswol » Fri, 26 Jul 1996 04:00:00



> If anyone has an answer for Jude, perhaps you can cc: me as well
> because I'm having a very similar problem:

> FORM1 is a form that normally opens with a filter condition on one of
> the fields (call it FORM1FIELD).

> I would like to open FORM1 from FORM2 with the filter condition
> removed.

> The code in FORM2 should look something like this:
> ________________________________________________
> var
>   theform   Form
> endvar

>   theform.open("FORM1.FSL")
>   theform.form1field.<<<<REMOVE FILTER CONDITION>>>>
> _________________________________________________

> Unfortunately, there doesn't seem to exist a UIO property for the
> filter condition on a field in a form.

> Can it be done?

> Michael Tylman
> __________________________________________________________
> Jude Maghirang Wrote:

> > OK, I give up.  I am trying to run a form filter with Object PAL but am
> > having surprisingly little luck.  Surprising because it seems like a
> > simple thing to do.  What I want is to display only records containing a
> > given value of "Recid#" in an open form.  The form is based on a data
> > model containing a table, e.g. "MyTable.DB".   I've been using code such
> > as the following:

> > method PushButton(var eventInfo Event)

> > var
> >         dynFltr DynArray[] AnyType
> >         frm Form
> >         tc TCursor
> >         fltrparm String
> >         tbl Table
> > endVar

> > tbl.attach("MyTable.db")

> > fltrparm="aaa"
> > dynFltr["Recid"]=fltrparm
> > tbl.setGenFilter(dynFltr)

> > endmethod

> >         The setGenFilter seems to work because if I do a tbl.cCount, it
> > returns the appropriate number(e.g. 3 of 10 records in the table have
> > Recid="aaa"). However, the resulting filtered data is in a TCursor object
> > that is not recognized by the form, i.e. the form still displays all 10
> > records. I tried using the dmAttach method to associate the TCursor
> > generated by setGenFilter to "MyTable.DB" which was successful (returned
> > "True") but the form itself was still displaying all the records in
> > "MyTable.DB" and not just the subset of records reflected by the filter.
> > Can anyone shed light on what I'm missing?

> > Thanks in advance,
> > Jude Maghirang
> > *ia Health Quality Center

What you need to do is to define a uiobject var in the calling form,
attach it to an field,record, or tablefram object on the called form
then drop the filter

var fm form ui uiobject endvar
 switch
  case not fm.open("newform"):
  case not ui.attach(fm,"objname"):
  case not ui.dropgenfilter():
  otherwise:
   view("OK")
   return
 endswitch
 view("Oops, didn't happen!")

Of course you could build an dynarray and use setgenfilter(arr) instead
of dropgenfilter()

Gene G.

 
 
 

Form filter using OPAL???

Post by Daniel A. Morga » Fri, 26 Jul 1996 04:00:00


Quote:> OK, I give up.  I am trying to run a form filter with Object PAL but am
> having surprisingly little luck. What I want is to display only records
> containing a given value of "Recid#" in an open form. The form is based
> on a data model containing a table, e.g. "MyTable.DB".

Forget setGenFilter. It is a last resort, not the method of choice. First
create a secondary index on the fields that correspond to your dynArray
dynFltr. Then in your code all you need to do is:

tc.open("Mytable.db")                 ; Open the tCursor
tc.switchIndex("TheIndicesName")      ; Switch to secondary index
tc.setRange(TheFilterCriteria)          ; Set the display range
uiObject.reSync(tc)                     ; Resync tableframe or mro

Daniel Morgan
EXE Solutions

 
 
 

Form filter using OPAL???

Post by Dwayne Zo » Fri, 26 Jul 1996 04:00:00



> If anyone has an answer for Jude, perhaps you can cc: me as well
> because I'm having a very similar problem:

> FORM1 is a form that normally opens with a filter condition on one of
> the fields (call it FORM1FIELD).

> I would like to open FORM1 from FORM2 with the filter condition
> removed.

> The code in FORM2 should look something like this:
> ________________________________________________
> var
>   theform   Form
> endvar

>   theform.open("FORM1.FSL")
>   theform.form1field.<<<<REMOVE FILTER CONDITION>>>>
> _________________________________________________

> Unfortunately, there doesn't seem to exist a UIO property for the
> filter condition on a field in a form.

> Can it be done?

> Michael Tylman
> __________________________________________________________
> Jude Maghirang Wrote:

> > OK, I give up.  I am trying to run a form filter with Object PAL but am
> > having surprisingly little luck.  Surprising because it seems like a
> > simple thing to do.  What I want is to display only records containing a
> > given value of "Recid#" in an open form.  The form is based on a data
> > model containing a table, e.g. "MyTable.DB".   I've been using code such
> > as the following:

> > method PushButton(var eventInfo Event)

> > var
> >         dynFltr DynArray[] AnyType
> >         frm Form
> >         tc TCursor
> >         fltrparm String
> >         tbl Table
> > endVar

> > tbl.attach("MyTable.db")

> > fltrparm="aaa"
> > dynFltr["Recid"]=fltrparm
> > tbl.setGenFilter(dynFltr)

> > endmethod

> >         The setGenFilter seems to work because if I do a tbl.cCount, it
> > returns the appropriate number(e.g. 3 of 10 records in the table have
> > Recid="aaa"). However, the resulting filtered data is in a TCursor object
> > that is not recognized by the form, i.e. the form still displays all 10
> > records. I tried using the dmAttach method to associate the TCursor
> > generated by setGenFilter to "MyTable.DB" which was successful (returned
> > "True") but the form itself was still displaying all the records in
> > "MyTable.DB" and not just the subset of records reflected by the filter.
> > Can anyone shed light on what I'm missing?

> > Thanks in advance,
> > Jude Maghirang
> > *ia Health Quality Center

Try:
f.open("second form")
f.dropgenfilter()
 
 
 

Form filter using OPAL???

Post by Dwayne Zo » Fri, 26 Jul 1996 04:00:00



> OK, I give up.  I am trying to run a form filter with Object PAL but am
> having surprisingly little luck.  Surprising because it seems like a
> simple thing to do.  What I want is to display only records containing a
> given value of "Recid#" in an open form.  The form is based on a data
> model containing a table, e.g. "MyTable.DB".   I've been using code such
> as the following:

> method PushButton(var eventInfo Event)

> var
>         dynFltr DynArray[] AnyType
>         frm Form
>         tc TCursor
>         fltrparm String
>         tbl Table
> endVar

> tbl.attach("MyTable.db")

> fltrparm="aaa"
> dynFltr["Recid"]=fltrparm
> tbl.setGenFilter(dynFltr)

> endmethod

>         The setGenFilter seems to work because if I do a tbl.cCount, it
> returns the appropriate number(e.g. 3 of 10 records in the table have
> Recid="aaa"). However, the resulting filtered data is in a TCursor object
> that is not recognized by the form, i.e. the form still displays all 10
> records. I tried using the dmAttach method to associate the TCursor
> generated by setGenFilter to "MyTable.DB" which was successful (returned
> "True") but the form itself was still displaying all the records in
> "MyTable.DB" and not just the subset of records reflected by the filter.
> Can anyone shed light on what I'm missing?

> Thanks in advance,
> Jude Maghirang
> *ia Health Quality Center

Try

method PushButton(var eventInfo Event)

 var
         dynFltr DynArray[] AnyType
         frm Form
         fltrparm String
 endVar

 fltrparm="aaa"
 dynFltr["Recid"]=fltrparm
 setGenFilter(dynFltr)

 endmethod

I'm sure this should work, but you might have to direct the setgenfilter at a table
(this would be true if you have more than one table on the form).  Anyway you could do a
fieldname.setgenfilter(dynfltr) on any field associated with table you wish to filter.

 
 
 

Form filter using OPAL???

Post by Andrew Benne » Sat, 27 Jul 1996 04:00:00



>method PushButton(var eventInfo Event)
>var
>    dynFltr DynArray[] AnyType
>    frm Form
>    tc TCursor
>    fltrparm String
>    tbl Table
>endVar
>tbl.attach("MyTable.db")
>fltrparm="aaa"
>dynFltr["Recid"]=fltrparm
>tbl.setGenFilter(dynFltr)
>endmethod
>    The setGenFilter seems to work because if I do a tbl.cCount, it
>returns the appropriate number(e.g. 3 of 10 records in the table have
>Recid="aaa"). However, the resulting filtered data is in a TCursor object
>that is not recognized by the form, i.e. the form still displays all 10
>records.

You are applying the setGenFilter in the wrong place.  You want
setGenFilter of the UIObject Type, not of the Table type, if you want
to visually see the results on the form.  Since each view of the table
is independent of each other, you'll need to attach() each var to
whatever view you want the var to inherit.

The UIObject on the form (tableframe?  field?  whatever it is) has a
name.  Figure out what the name is.  In Paradox 5, you can right click
on the object in design mode, and the top entry in the pop up list is
the UIObject name.  If it has a # sign in front of it, it's called a
"noise name", so give it a unique name and remove the # sign.  In
Paradox 7, it's the left hand side of the Object Explorer.  (In both,
you can single click and the status bar should display the UIObject
name.)

Now with the code sample you posted (above), remove the attach()
statement, remove 'tbl' from the declaration section, and change

tbl.setGenFilter(dynFltr)

to

if not UIObjectname.setGenFilter(dynFltr) then
   errorShow("Placing the filter failed")
endif

"UIObjectname" is the name of the object.

Hope that helps.  You can check the code example for setGenFilter of
the UIObject type for a full example.

Andrew
--
  Andrew Bennett

  http://taz.hyperreal.com/~abennett/

 
 
 

Form filter using OPAL???

Post by Kase » Sat, 27 Jul 1996 04:00:00




Quote:>OK, I give up.  I am trying to run a form filter with Object PAL but am
>having surprisingly little luck.  Surprising because it seems like a
>simple thing to do.  What I want is to display only records containing a
>given value of "Recid#" in an open form.  The form is based on a data
>model containing a table, e.g. "MyTable.DB".   I've been using code such
>as the following:
>method PushButton(var eventInfo Event)
>var
>    dynFltr DynArray[] AnyType
>    frm Form
>    tc TCursor
>    fltrparm String
>    tbl Table
>endVar
>tbl.attach("MyTable.db")
>fltrparm="aaa"
>dynFltr["Recid"]=fltrparm
>tbl.setGenFilter(dynFltr)

>endmethod

Okay, here's the problem. EVERY view of a table in Paradox is INDEPENDENT
of each other, UNLESS you use attach, in which case, the view is inherited
FROM THAT MOMENT.

Above, your tbl.attach got the "normal" view of MYTABLE, no filter.

Then you filtered the TBL. Correct.

Quote:>    The setGenFilter seems to work because if I do a tbl.cCount, it
>returns the appropriate number(e.g. 3 of 10 records in the table have
>Recid="aaa"). However, the resulting filtered data is in a TCursor object
>that is not recognized by the form, i.e. the form still displays all 10
>records. I tried using the dmAttach method to associate the TCursor
>generated by setGenFilter to "MyTable.DB" which was successful (returned
>"True") but the form itself was still displaying all the records in
>"MyTable.DB" and not just the subset of records reflected by the filter.  
>Can anyone shed light on what I'm missing?

BUT the tcursor you opened later, unless you opened TBL with it, will have
a COMPLETELY DIFFERENT VIEW, because they are INDEPENDENT OF EACH OTHER!

The "correct" way of doing this is to set the filter directly on the
TABLEFRAME object (uiobject) instead of setting it elsewhere and try to
have different views inherit it.

=========================================================================
Kasey K. S. Chang (a guy)             | Paradox for Windows Programmer

URL> http://userwww.sfsu.edu/~kschang | X-COM Guru among other things...
=========================================================================

 
 
 

Form filter using OPAL???

Post by Daniel A. Morga » Sun, 28 Jul 1996 04:00:00


Quote:> I would like to open FORM1 from FORM2 with the filter condition
> removed.

> The code in FORM2 should look something like this:
> ________________________________________________
> var
>   theform   Form
> endvar

>   theform.open("FORM1.FSL")
>   theform.form1field.<<<<REMOVE FILTER CONDITION>>>>
> _________________________________________________

What on earth are you doing? When you open a form the tables displayed on
that form and the tCursors opened to those tables from that form do not
inherit any conditions of any kind what-so-ever from anywhere else in
the application. There is nothing to remove.

And once again. Do not use setGenFilter() except as a last resort. Build
secondary indices and use setRange().

Daniel Morgan
EXE Solutions

 
 
 

1. Filters in a form with OPAL

Given a form and a tableframe linked to a table, I need to filter data
of the table and have the correct view on the tableframe, that is see
only the valid records.
The Filter command (rigth button click) works.
I tried setGenFilter..., but it does not work in the same way, because
it shows all the records and requires a tcursor scan.
Any help?
Thanks
PM

2. T-SQL OLE automation api and com objects

3. Using OPAL to print a form?

4. South UK MCP wanted for help

5. Moving between fields in a form using OPAL

6. What development application

7. Using a date-field in a server filter by form

8. Dbase III+ How do I access in native format?

9. Filter on Report with OPAL?

10. PW5/Help with OPAL Filter/Locate/Resync

11. Open & filter form from other form

12. How to filter many data in filter axis when using PiovtTable10

13. Help, Multiple Filters Using the Filter Property