Newbie Question - Report based on range of dates 
Author Message
 Newbie Question - Report based on range of dates

I'm stumped. Would someone please tell me how to or point me in the right
direction to be able to print a report in CW2.0 based upon a range of user
selected dates. I have the reports done, but I don't know where to go next
and I've searched the user guide. I guess I can't see the forest for the
trees.

Regards,

Bill

William Noseworthy
InfoSolve



Fri, 19 Mar 1999 03:00:00 GMT  
 Newbie Question - Report based on range of dates

Quote:

> I'm stumped. Would someone please tell me how to or point me in the right
> direction to be able to print a report in CW2.0 based upon a range of user
> selected dates. I have the reports done, but I don't know where to go next
> and I've searched the user guide. I guess I can't see the forest for the
> trees.

> Regards,

> Bill

> William Noseworthy
> InfoSolve


        Here is how I do it, but keep in mind I am just a hobbyist and
don't get to spend much time with CW. By the way, I am only using CW1.5
so things may be slightly different.

1st I add the following code to the report embed 'before opening progress
window'

 GlobalRequest = RequestCompleted
 InputFollowUpRange                 !this is the called procedure
 If GlobalResponse = RequestCancelled
    LocalResponse = RequestCancelled
    Do ProcedureReturn
 END

2. then from the report procedures window I select 'Procedure' and add a
new procedure, remember the name should match that in the above code.

3. I then add a couple of global date variables which correlate to the
fields you want to use to define the begining and end variables in the
report.

4. create a window with okay and cancel buttons (don't forget to add the
code to make em work) and insert the global data variable you created to
hold the start and end dates.

5. in the report properties click the 'report properties' bar and then
'range limit' tab and enter the range limit field you want to use from
the report. Range limti type should be set to 'Range of Value' and low
and high limit values should be your two global data field you created to
hold these values.

Then when you select the report it should open a window and ask for input
of the 2 global data fields, upon selecting okay it should use these to
determine which record to print in the report. Hope that helps:).

        Larry Hotchkiss
        Best Computer Service, Inc.
        www.winternet.com/~wcdc/bcs.html



Sat, 20 Mar 1999 03:00:00 GMT  
 Newbie Question - Report based on range of dates

William,

This is fairly easy to to do.  There are many ways to do this, but lets do
a simple approach - you can improve on this if you like.

In the embed of your report, Procedure setup, embed a "Call a procedure".  
Call it something like GetDates.  This will appear as a "todo" in your app
schematic.  Make this a window procedure with an OK and Cancel button.

Add two global fields, GLO:StartDate and GLO:EndDate (defined in the data
section of the global button.  Make them both LONGs with whatever date
picture you want.

At this point you can proceed one of two ways:

A) If your report has a file with a date field as part of the key, then use
the range limits properties on your report properties.  The upper and lower
limits with be the global variables.  The templates will handle the rest.

B) Add another embed to your report procedure setup embed, this time a
source type as you need to construct your filter string (GLO:ReportFilter
STRING(255)).  You can make it something like this:

GLO:ReportFilter = 'PRE:DateField >= ' & GLO:StartDate & ' AND
PRE:DateField <<= ' & GLO:EndDate

This will build your filter string to contain the correct expression for
your range limits.  Now add another embed "Before first record retrieved"
and make it a source embed and add one line:

Process:View{PROP:Filter} = GLO:ReportFilter

This is a general overview on how you can do this.  You can see that you
may need to add some more code to check that the Start date is not later
than the end date, what if there is no end date - is this allowed, etc...

I think this will get you going in the right direction.

HTH,

--
Russell B. Eggen
Topspeed Corporation
Consulting Division

[Using MS NewsServer]



Quote:
> I'm stumped. Would someone please tell me how to or point me in the right
> direction to be able to print a report in CW2.0 based upon a range of
user
> selected dates. I have the reports done, but I don't know where to go
next
> and I've searched the user guide. I guess I can't see the forest for the
> trees.

> Regards,

> Bill

> William Noseworthy
> InfoSolve




Sat, 20 Mar 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. problems generating a report with a date range

2. Setting date Range on a report

3. What are base subtype and base range ??

4. Newbie question / how to select a column range?

5. Newbie question (Range Specifiers)

6. CW4 - Ranges question - changing range values while running

7. newbie question: how to exclude rows in file based on pattern

8. Newbie date question please

9. Newbie question on returning system date and time...

10. Newbie Question (Web Based Ada Tutorials)

11. newbie question about event based programming

 

 
Powered by phpBB® Forum Software