dbTalk Databases Forums  

Filter for Report not working?????

comp.databases.paradox comp.databases.paradox


Discuss Filter for Report not working????? in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeanette
 
Posts: n/a

Default Filter for Report not working????? - 09-13-2006 , 04:35 PM







I have a Table that has a ContractNo field.
Data looks like: 99-309-014 or 00-303-001 etc

I want the User to be able to request a report via ContractNo
I have tried:
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.

What am I doing wrong?

TIA
Jeanette


Reply With Quote
  #2  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-13-2006 , 04:44 PM







Look at HELP for setGenFilter.

I believe it says that values for a genfilter that **start with** a numeric
character have to be 'escaped'.
One backslash to say 'take next character litterally, and one backslash to
say number following.

; "99-309-014" = subtract 309 from 99, and sutract 14 from that

Perhaps cno="\\"+ContractNo.value


---------------------------------------------------------
Tony McGuire



Reply With Quote
  #3  
Old   
OzPaul
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-13-2006 , 07:12 PM



Jeanette, Personally I prefer having a "ContractNo" table as the master
table of the report model and using a tcursor to copy the value of
interest over before opening the report. Works very quickly and
reliably. I have generally found filters frustratingly slow. Regards
Paul.




Jeanette wrote:

Quote:
I have a Table that has a ContractNo field.
Data looks like: 99-309-014 or 00-303-001 etc

I want the User to be able to request a report via ContractNo
I have tried:
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.

What am I doing wrong?

TIA
Jeanette


Reply With Quote
  #4  
Old   
Kim Howarter
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-13-2006 , 10:02 PM



Jeanette,

To build on what Paul said, you can use a TCursor to get the value and
then use the value to select the correct record in a Query and save the
answer table to the private directory. Then create your report using
that table.

Another option is to use a TCursor on the table to locate your record
and use the instantiateView to save the table in the Private directory
to create your report from. Look it up in the TCursor help.

Kim

Jeanette wrote:
Quote:
I have a Table that has a ContractNo field.
Data looks like: 99-309-014 or 00-303-001 etc

I want the User to be able to request a report via ContractNo
I have tried:
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.

What am I doing wrong?

TIA
Jeanette



Reply With Quote
  #5  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-14-2006 , 02:00 PM



Jeanette

You have already got some advices on how to apply a filter to a report by
using a different table, but the code you showed is worth some comments.

<<
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.
Quote:
You don't tell us what cash is. It looks like you apply a filter to a table
variable. But then you're opening a report. When you open a report, it
ignores completely waht you have done with variables in your form. There are
ways of applying a filter, setGenfilter(), to a report. From ObjectPAL help
files:
< Quote >
· If you use setGenFilter on a UIObject in a running report, the filter does
not take effect until you run the report again. For example, the following
code runs a report and sets a filter; however, the filter has no effect
until the report switches to design mode and then back into run mode.

method pushButton(var eventInfo Event)
var
reOrders Report
daCriteria DynArray[] AnyType
endVar

reOrders.open("orders")

daCriteria["OrderNo"] = "> 1234"

; Assume the report contains a table frame bound to the Orders table.
; This statement has no effect because the report is in run mode.
reOrders.ORDERS.setGenFilter(daCriteria)

reOrders.design()
reOrders.run() ; Now the filter takes effect.
endMethod
< /Quote >


--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Jeanette" <harrisjr (AT) bwsc (DOT) org> skrev i meddelandet
news:450879a2 (AT) pnews (DOT) thedbcommunity.com...
Quote:
I have a Table that has a ContractNo field.
Data looks like: 99-309-014 or 00-303-001 etc

I want the User to be able to request a report via ContractNo
I have tried:
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.

What am I doing wrong?

TIA
Jeanette




Reply With Quote
  #6  
Old   
Jeanette
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-15-2006 , 01:48 PM




Bertil,

I decided to go with a table in PRIV for the report.

UNFORTUNATELY, the app that is written in Paradox is more than 10 years old
and VERY RARELY needs maintenance and less often than VERY RARELY do I get
a request to add new functionality. When I get a request to add new functionality
or a request for maintenance I do try to 'do it' by using something that
I have not used before - hence the setGenFilter.

I completely understand my error with using setGenFilter after you pointed
it out to me AND I had suspected that the setGenFilter was not being used
when I opened the report to print it. I had checked the variable before
calling the report and all was well. HOWEVER, if I were to use setGenFilter
as you have described I csn tell you that most of my Users would never ignore
the first report and then open the form again to print he second filtered
Report. They would hum along killing trees ļ !
Creating a table in PRIV is the best solution.

NOW, how about the form?
I am using a filter in OPAL and I am not getting the results I expected.
I expected the form to display records as if the ones requested by the filter
were the only records in the table. Instead it seems that the filter moves
to the 1st instance of the requested records, displays the group AND everything
thereafter AND if you use the scrollbar ALL of the records in the table will
be displayed.

Is this the way it is supposed to work?


"Bertil Isberg" <ctech (AT) corel (DOT) ca> wrote:
Quote:
Jeanette

You have already got some advices on how to apply a filter to a report by

using a different table, but the code you showed is worth some comments.


cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.


You don't tell us what cash is. It looks like you apply a filter to a table

variable. But then you're opening a report. When you open a report, it
ignores completely waht you have done with variables in your form. There
are
ways of applying a filter, setGenfilter(), to a report. From ObjectPAL
help
files:
Quote
¡P If you use setGenFilter on a UIObject in a running report, the filter
does
not take effect until you run the report again. For example, the following

code runs a report and sets a filter; however, the filter has no effect

until the report switches to design mode and then back into run mode.

method pushButton(var eventInfo Event)
var
reOrders Report
daCriteria DynArray[] AnyType
endVar

reOrders.open("orders")

daCriteria["OrderNo"] = "> 1234"

; Assume the report contains a table frame bound to the Orders table.
; This statement has no effect because the report is in run mode.
reOrders.ORDERS.setGenFilter(daCriteria)

reOrders.design()
reOrders.run() ; Now the filter takes effect.
endMethod
/Quote


--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Jeanette" <harrisjr (AT) bwsc (DOT) org> skrev i meddelandet
news:450879a2 (AT) pnews (DOT) thedbcommunity.com...

I have a Table that has a ContractNo field.
Data looks like: 99-309-014 or 00-303-001 etc

I want the User to be able to request a report via ContractNo
I have tried:
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.

What am I doing wrong?

TIA
Jeanette





Reply With Quote
  #7  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-15-2006 , 02:14 PM



Jeanette
<<
NOW, how about the form?
I am using a filter in OPAL and I am not getting the results I expected.
I expected the form to display records as if the ones requested by the
filter
were the only records in the table. Instead it seems that the filter moves
to the 1st instance of the requested records, displays the group AND
everything
thereafter AND if you use the scrollbar ALL of the records in the table will
be displayed.

Is this the way it is supposed to work?
Quote:
No, it's not the way it should work. You have to show the code you're using.
You can find example coe in the ObjectPAL reference help files. Search the
index for setGenFilter() and select the uiObject type version of method.

--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Jeanette" <harrisjr (AT) bwsc (DOT) org> skrev i meddelandet
news:450af575$1 (AT) pnews (DOT) thedbcommunity.com...
Quote:
Bertil,

I decided to go with a table in PRIV for the report.

UNFORTUNATELY, the app that is written in Paradox is more than 10 years
old
and VERY RARELY needs maintenance and less often than VERY RARELY do I get
a request to add new functionality. When I get a request to add new
functionality
or a request for maintenance I do try to 'do it' by using something that
I have not used before - hence the setGenFilter.

I completely understand my error with using setGenFilter after you pointed
it out to me AND I had suspected that the setGenFilter was not being used
when I opened the report to print it. I had checked the variable before
calling the report and all was well. HOWEVER, if I were to use
setGenFilter
as you have described I csn tell you that most of my Users would never
ignore
the first report and then open the form again to print he second filtered
Report. They would hum along killing trees ļ !
Creating a table in PRIV is the best solution.

NOW, how about the form?
I am using a filter in OPAL and I am not getting the results I expected.
I expected the form to display records as if the ones requested by the
filter
were the only records in the table. Instead it seems that the filter
moves
to the 1st instance of the requested records, displays the group AND
everything
thereafter AND if you use the scrollbar ALL of the records in the table
will
be displayed.

Is this the way it is supposed to work?


"Bertil Isberg" <ctech (AT) corel (DOT) ca> wrote:
Jeanette

You have already got some advices on how to apply a filter to a report by

using a different table, but the code you showed is worth some comments.


cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.


You don't tell us what cash is. It looks like you apply a filter to a
table

variable. But then you're opening a report. When you open a report, it
ignores completely waht you have done with variables in your form. There
are
ways of applying a filter, setGenfilter(), to a report. From ObjectPAL
help
files:
Quote
¡P If you use setGenFilter on a UIObject in a running report, the filter
does
not take effect until you run the report again. For example, the following

code runs a report and sets a filter; however, the filter has no effect

until the report switches to design mode and then back into run mode.

method pushButton(var eventInfo Event)
var
reOrders Report
daCriteria DynArray[] AnyType
endVar

reOrders.open("orders")

daCriteria["OrderNo"] = "> 1234"

; Assume the report contains a table frame bound to the Orders table.
; This statement has no effect because the report is in run mode.
reOrders.ORDERS.setGenFilter(daCriteria)

reOrders.design()
reOrders.run() ; Now the filter takes effect.
endMethod
/Quote


--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Jeanette" <harrisjr (AT) bwsc (DOT) org> skrev i meddelandet
news:450879a2 (AT) pnews (DOT) thedbcommunity.com...

I have a Table that has a ContractNo field.
Data looks like: 99-309-014 or 00-303-001 etc

I want the User to be able to request a report via ContractNo
I have tried:
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.

What am I doing wrong?

TIA
Jeanette







Reply With Quote
  #8  
Old   
Jeanette
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-15-2006 , 04:06 PM




Bertil,

Here's what I had coded:
I have a form with a table frame on it
Here’s the gist of what I was doing…

contFilter dynArray[] String

Cno2 = ContractNo.value
contFilter["ContractNo"] = cno2
the above produced what I described below.

I added a field called Month because my ContractNo field is made up of numbers
& hyphens and I thought maybe THAT was causing the problem. ContractNo EXamples
are = 99-309-014, 00-309-006

Using the setGenFilter for UIobject I NOW have coded:
cno2, cField string
contFilter DynArray[] String

cno2 = "May"
cField = "Month"
contFilter[cField] = cno2
CashFlow.setGenFilter(contFilter)

When the above code is run I get this error message -
The Ffilter expression in field Month is not valid.
HELP !

"Bertil Isberg" <ctech (AT) corel (DOT) ca> wrote:
Quote:
Jeanette

NOW, how about the form?
I am using a filter in OPAL and I am not getting the results I expected.
I expected the form to display records as if the ones requested by the
filter
were the only records in the table. Instead it seems that the filter moves
to the 1st instance of the requested records, displays the group AND
everything
thereafter AND if you use the scrollbar ALL of the records in the table
will
be displayed.

Is this the way it is supposed to work?


No, it's not the way it should work. You have to show the code you're using.
You can find example coe in the ObjectPAL reference help files. Search the

index for setGenFilter() and select the uiObject type version of method.

--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Jeanette" <harrisjr (AT) bwsc (DOT) org> skrev i meddelandet
news:450af575$1 (AT) pnews (DOT) thedbcommunity.com...

Bertil,

I decided to go with a table in PRIV for the report.

UNFORTUNATELY, the app that is written in Paradox is more than 10 years

old
and VERY RARELY needs maintenance and less often than VERY RARELY do I
get
a request to add new functionality. When I get a request to add new
functionality
or a request for maintenance I do try to 'do it' by using something that
I have not used before - hence the setGenFilter.

I completely understand my error with using setGenFilter after you pointed
it out to me AND I had suspected that the setGenFilter was not being used
when I opened the report to print it. I had checked the variable before
calling the report and all was well. HOWEVER, if I were to use
setGenFilter
as you have described I csn tell you that most of my Users would never

ignore
the first report and then open the form again to print he second filtered
Report. They would hum along killing trees ļ !
Creating a table in PRIV is the best solution.

NOW, how about the form?
I am using a filter in OPAL and I am not getting the results I expected.
I expected the form to display records as if the ones requested by the

filter
were the only records in the table. Instead it seems that the filter

moves
to the 1st instance of the requested records, displays the group AND
everything
thereafter AND if you use the scrollbar ALL of the records in the table

will
be displayed.

Is this the way it is supposed to work?


"Bertil Isberg" <ctech (AT) corel (DOT) ca> wrote:
Jeanette

You have already got some advices on how to apply a filter to a report
by

using a different table, but the code you showed is worth some comments.


cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.


You don't tell us what cash is. It looks like you apply a filter to a

table

variable. But then you're opening a report. When you open a report, it
ignores completely waht you have done with variables in your form. There
are
ways of applying a filter, setGenfilter(), to a report. From ObjectPAL
help
files:
Quote
¡P If you use setGenFilter on a UIObject in a running report, the filter
does
not take effect until you run the report again. For example, the following

code runs a report and sets a filter; however, the filter has no effect

until the report switches to design mode and then back into run mode.

method pushButton(var eventInfo Event)
var
reOrders Report
daCriteria DynArray[] AnyType
endVar

reOrders.open("orders")

daCriteria["OrderNo"] = "> 1234"

; Assume the report contains a table frame bound to the Orders table.
; This statement has no effect because the report is in run mode.
reOrders.ORDERS.setGenFilter(daCriteria)

reOrders.design()
reOrders.run() ; Now the filter takes effect.
endMethod
/Quote


--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Jeanette" <harrisjr (AT) bwsc (DOT) org> skrev i meddelandet
news:450879a2 (AT) pnews (DOT) thedbcommunity.com...

I have a Table that has a ContractNo field.
Data looks like: 99-309-014 or 00-303-001 etc

I want the User to be able to request a report via ContractNo
I have tried:
cno = ContractNo.value
cnoRpt["ContractNo"] = cno
cash.attach("CASHFLOW")
cash.setGenFilter(cnoRpt)

if rept1.open("CASHFLOW1") then
rept1.print()
rept1.close()
else
msgInfo("Problem.", "Couldn't open the report for the FIRST 6 months")
endif

The report ignores the filter.

What am I doing wrong?

TIA
Jeanette








Reply With Quote
  #9  
Old   
Jim Moseley
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-15-2006 , 04:11 PM




Jeanette,

I've got 2 guesses. Since your ContractNo contains '-', you should enclose
it in quotes, otherwise it could be treated as a calculation. Secondly,
you need to check for an error on each command.

cno = ContractNo.value
cnoRpt["ContractNo"] = ""\" + cno + ""\"
ok = cash.attach("CASHFLOW")
if ok then
ok = cash.setGenFilter(cnoRpt)
endif
if not ok then
errorShow()
return
endif

Thanks,
Jim Moseley

Reply With Quote
  #10  
Old   
Jim Moseley
 
Posts: n/a

Default Re: Filter for Report not working????? - 09-15-2006 , 04:19 PM




Quote:
cnoRpt["ContractNo"] = ""\" + cno + ""\"
Oops, I posted the format wrong. It should be:

cnoRpt["ContractNo"] = "\"" + cno + "\""




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.