cw 2.0003, filter box on report properties is too small, need help...mucho 
Author Message
 cw 2.0003, filter box on report properties is too small, need help...mucho

hey everyone,

i've got a report that needs to filter for 12 selected categories.  the record
filter box in the report properties is too small. i've tried different embeds
and tried creating a source proc that sets a variable and then call that proc
from the record filter like this catfilt() = 'Y'. i think i've got the variable
bound in the report procedure where i need the large filter. i've just been
beating my head against the wall. i know i'm close,but still just a little
short on insight. tech support told me to put my code in with the 'source'
option on report properties, but it gets overwriten when i regenerate.  i
really need the cool breeze of reason. thanks in advance...mucho.

here is the filter code that i don't know what to do with...

 ! filters selected cats
 ! this is CATFILT source proc, used for rep filter for selected categories

 ! if selected_cat_ok = 'Y'
 ! catok is a global variable

 catok='N'
 if equ:sale_status <> 'Y'

  if repcat1 = equ:cat_num
   catok = 'Y'
  .

  if repcat2 = equ:cat_num
    catok = 'Y'
  .

  if repcat3 = equ:cat_num
    catok = 'Y'
  .
  if repcat4 = equ:cat_num
    catok = 'Y'
  .
  if repcat5 = equ:cat_num
    catok = 'Y'
  .
  if repcat6 = equ:cat_num
    catok = 'Y'
  .
  if repcat7 = equ:cat_num
   catok = 'Y'
  .
  if repcat8 = equ:cat_num
   fillcats(repcat8)
  .
  if repcat9 = equ:cat_num
   catok = 'Y'
  .
  if repcat10 = equ:cat_num
   catok = 'Y'
  .
  if repcat11 = equ:cat_num
   catok = 'Y'
  .
  if repcat12 = equ:cat_num
   catok = 'Y'
  .

  if catok = 'Y' and (equ:not_in_inv <> 'Y' or equ:not_in_inv = invstat)
   catok = 'Y'
  else
   catok = 'N'
  .

 . ! end of if sale_status <> 'Y'
  ! filters selected cats
 ! this is CATFILT source proc, used for rep filter for selected categories

 ! if selected_cat_ok = 'Y'
 ! catok is a global variable

 catok='N'
 if equ:sale_status <> 'Y'

  if repcat1 = equ:cat_num
   catok = 'Y'
  .

  if repcat2 = equ:cat_num
    catok = 'Y'
  .

  if repcat3 = equ:cat_num
    catok = 'Y'
  .
  if repcat4 = equ:cat_num
    catok = 'Y'
  .
  if repcat5 = equ:cat_num
    catok = 'Y'
  .
  if repcat6 = equ:cat_num
    catok = 'Y'
  .
  if repcat7 = equ:cat_num
   catok = 'Y'
  .
  if repcat8 = equ:cat_num
   fillcats(repcat8)
  .
  if repcat9 = equ:cat_num
   catok = 'Y'
  .
  if repcat10 = equ:cat_num
   catok = 'Y'
  .
  if repcat11 = equ:cat_num
   catok = 'Y'
  .
  if repcat12 = equ:cat_num
   catok = 'Y'
  .

  if catok = 'Y' and (equ:not_in_inv <> 'Y' or equ:not_in_inv = invstat)
   catok = 'Y'
  else
   catok = 'N'
  .

 . ! end of if sale_status <> 'Y'



Sat, 29 Jun 2002 03:00:00 GMT  
 cw 2.0003, filter box on report properties is too small, need help...mucho
Samuel,

        in 2.003 use the embed point   BEFORE SET ISSUED to do as follows:

1) Build your filter expression as a string (I use LOC:FILTER to hold the
string).
2) Apply the filter expression to the view.
3) Include an OMIT statement to skip past the Clarion generated filter.
4) On the report properties enter     TRUE    as the filter expression,
your code will change this filter but, AFAIK, this will ensure the filter
code gets generated and your effort is rewarded with success.

See the following example (hope it works for you):

HTH
Jes

Programming is:  When you turn a good idea into CODE.
Learn how to avoid Y2K -- don't put dates
in your applications.

!SAMPLE [980401] BUILD FILTER Before Set Issued
!1)
CLEAR(LOC:FILTER)
LOC:FILTER  =  'TRA:FileNo = TRC:FileNo'            !Match selected file
number
!----------------------------------------------------------------------
IF WIP:AGEFROM > 0        !  Low Age selected
    LOC:FILTER = CLIP(LOC:FILTER) & ' AND TRA:VesselAge >= WIP:AgeFrom'
END
!----------------------------------------------------------------------
IF WIP:AGETO < 99            ! High Age selected
    LOC:FILTER = CLIP(LOC:FILTER) & ' AND WIP:AgeTo >= TRA:VesselAge'
END
!----------------------------------------------------------------------
IF ~WIP:AllClients                ! Specific client only
    LOC:FILTER = CLIP(LOC:FILTER) & ' AND WIP:ClientNo = TRA:ClientNo'
END
!----------------------------------------------------------------------
!    AND ANY OTHER EXPRESSIONS YOU LIKE
!    Make sure that each additional expression is added
!    with a  space as the first character before any AND or OR
!    My report queries are kept in a file (WIP:) and applied as a
!    Filter which you see generated here against the data file (TRA:)
!----------------------------------------------------------------------
SET(TRA:KeyClientFile)
Process:View{Prop:Filter} = CLIP(LOC:FILTER)
IF ERRORCODE()
   StandardWarning(Warn:ViewOpenError)
END
OPEN(Process:View)                          ! END OF Modification for Filter
OMIT('OPEN(Process:View)')             ! Omit the original Filter


Quote:
> hey everyone,

> i've got a report that needs to filter for 12 selected categories.  the
record
> filter box in the report properties is too small. i've tried different
embeds
> and tried creating a source proc that sets a variable and then call that
proc
> from the record filter like this catfilt() = 'Y'. i think i've got the
variable
> bound in the report procedure where i need the large filter. i've just
been
> beating my head against the wall. i know i'm close,but still just a little
> short on insight. tech support told me to put my code in with the 'source'
> option on report properties, but it gets overwriten when i regenerate.  i
> really need the cool breeze of reason. thanks in advance...mucho.

> here is the filter code that i don't know what to do with...

>  ! filters selected cats
>  ! this is CATFILT source proc, used for rep filter for selected
categories

>  ! if selected_cat_ok = 'Y'
>  ! catok is a global variable

>  catok='N'
>  if equ:sale_status <> 'Y'

>   if repcat1 = equ:cat_num
>    catok = 'Y'
>   .

>   if repcat2 = equ:cat_num
>     catok = 'Y'
>   .

>   if repcat3 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat4 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat5 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat6 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat7 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat8 = equ:cat_num
>    fillcats(repcat8)
>   .
>   if repcat9 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat10 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat11 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat12 = equ:cat_num
>    catok = 'Y'
>   .

>   if catok = 'Y' and (equ:not_in_inv <> 'Y' or equ:not_in_inv = invstat)
>    catok = 'Y'
>   else
>    catok = 'N'
>   .

>  . ! end of if sale_status <> 'Y'
>   ! filters selected cats
>  ! this is CATFILT source proc, used for rep filter for selected
categories

>  ! if selected_cat_ok = 'Y'
>  ! catok is a global variable

>  catok='N'
>  if equ:sale_status <> 'Y'

>   if repcat1 = equ:cat_num
>    catok = 'Y'
>   .

>   if repcat2 = equ:cat_num
>     catok = 'Y'
>   .

>   if repcat3 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat4 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat5 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat6 = equ:cat_num
>     catok = 'Y'
>   .
>   if repcat7 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat8 = equ:cat_num
>    fillcats(repcat8)
>   .
>   if repcat9 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat10 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat11 = equ:cat_num
>    catok = 'Y'
>   .
>   if repcat12 = equ:cat_num
>    catok = 'Y'
>   .

>   if catok = 'Y' and (equ:not_in_inv <> 'Y' or equ:not_in_inv = invstat)
>    catok = 'Y'
>   else
>    catok = 'N'
>   .

>  . ! end of if sale_status <> 'Y'



Sat, 29 Jun 2002 03:00:00 GMT  
 cw 2.0003, filter box on report properties is too small, need help...mucho

Quote:
>i've got a report that needs to filter for 12 selected categories.  the
record
>filter box in the report properties is too small.

Hi Samuel

There is an embed to do the filtering. It is called Validate Record:
Filter Checking.  EXIT will cause the record to be filtered.

If SomeCondition
  Exit       ! This will filter the record
End

Your code will fit in there very neatly.

Regards
Malcolm Collett
-------------------------------------
EMAIL: mcollett AT iafrica DOT com
=====================================



Sat, 29 Jun 2002 03:00:00 GMT  
 cw 2.0003, filter box on report properties is too small, need help...mucho
jes

i reply right away, so i still will try out your insight. thank you very much
for your help.muddling thru... but to victory.

sam



Sat, 29 Jun 2002 03:00:00 GMT  
 cw 2.0003, filter box on report properties is too small, need help...mucho
I have some very tricky and lengthy filters, but it's not too difficult to
create a filter function for your report and/or browse (I use the same
filter on a report as on a browse). With a filter function, you can create
the filters you want with IF and CASE logic. I recommend you create a filter
function.

In the filter box, all you need then is the name of the function, e.g.
MyFilter() or Report1Filter()

One of the nicest things about a filter function is you can access other
files if necessary. For example, if you want to filter invoices by their
customer credit rating.

Here's how to create a filter function in cw2.003:

Create a new procedure; name it Report1Filter.

In the properties of the procedure, put this in the Prototype field:
(),LONG
this will make the procedure a function. This prototype code means that the
function will be taking no parameters, and will return a LONG variable. The
function will be looking at the records being filtered. It can also look at
any related or looked up files.

In the Parameters field, simply put ()

Now in the Processed code embed, you can put in code like this:

  CASE Glo:ClosedSelection
  OF 'C'   ! Closed
    IF NOT Log:Closed THEN RETURN(FALSE).
  OF 'O'   ! Open
    IF Log:Closed THEN RETURN(FALSE).
  ELSE
  END

  RETURN(TRUE)

This code will produce a report or browse depending on Log:Closed field. You
RETURN(FALSE) if you want to filter out the record. You RETURN(TRUE) if you
want to print or browse the record. Is this a lot simpler to write and
understand this code?

That's about it. Only one more thing. You have to bind the function in your
report or browse procedure. You can do this in the Initialize the Procedure,
e.g.

BIND('Report1Filter',Report1Filter)

Bob Campbell
Certified Clarion Developer
Las Vegas, USA.



Sat, 29 Jun 2002 03:00:00 GMT  
 cw 2.0003, filter box on report properties is too small, need help...mucho
malcom

thanks for your reply.  i'll give it a shot. and muddle thru on the learning
curve.

sam



Tue, 02 Jul 2002 03:00:00 GMT  
 cw 2.0003, filter box on report properties is too small, need help...mucho
bob

oh man, that's the answer i was looking for ! i got some good responses, but
this is the kind of elegant rusable solution i needed. i've done it for a long
time in cpd 2.1 just like that, but i needed to learn how in cw. i knew it had
to be there. i believe you've saved the wall and my head and i thank you.  it
looks like you are a 'michael jordan' of clarion dev in windows. i've been
doing cpd for 12 years, but need to get up to speed fast on cw.  where could i
get some good reference/learning tools ? would it be best to go to cw 5.0 ?  if

and you will be wise. i greatly appreciate your help.

webetalk

sam



Tue, 02 Jul 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. CW 2.0003 on W95 network

2. Sending Filters To a Cw Report Writer Report

3. Sending Filters To a Cw Report Writer Report

4. CW List Box Properties

5. 2.0003 and NT4 compatibility

6. Dynamically changing box properties in report

7. Fine alignment (small labels) in a CW Report

8. CW Filtered Reports 'hang' PC

9. Lost ToolBox, Property Box and Field Box !!

10. Need advice, ABC Report Filtering?

11. Help in using Filtered in Browse Box

12. Need filter for Clarion Report Writer

 

 
Powered by phpBB® Forum Software