That did it!
I know I had tried something like that and got to the dumb Omit loop through
desperation...
BTW the problem was that it was returning everything: I.e., the report
worked but the Omit loop didn't.

Now, second question: I have a range: could by 2007 and 2008 for From and
Two years (it is just a year).
How do I get a from - to range into that Set?

Thanks!
Ron

-----Original Message-----
From: FileMaker Pro Discussions [mailto:[email protected]] On
Behalf Of Steve Cassidy
Sent: Saturday, December 20, 2008 9:19 AM
To: [email protected]
Subject: Re: Summary Report

Ron

> I want a report which counts the number of Registrations per Class,  
> where Registration relates to Registration_Class by ClassID.
> Actually that works fine.

Good. Can you confirm that it works with the exact script below but  
with the lines from Go To Record/Request/Page [First] up to End Loop  
disabled? If so, then your report is basically OK.

Unfortunately, you do not tell us how/why the report doesn't work.  
But I'd bet it is your omit process.

> However, I want to restrict the report to a specific year as in  
> ClassYear (in Class) = 2008.

A date is not the same as a year. You can't successfully compare 2008  
against 1/1/2008 (for example) in a calculation. Is this the problem?

> I can't do it in a Find and I can't do it via script which I  
> prefer: the following script has a global gFromDate and gThruDate  
> in the Class table set to the date range I want, but doesn't work.

If Registration_Class::ClassYear contains data such as 2008 and 2007,  
then all you need is a simple find step in your script. Forget all  
that (slow) looping and omitting. Something like this:

Enter Find Mode
Set Field [Registration_Class::ClassYear, gYear]
Perform Find [do not restore]

(where gYear is a global holding the year you are looking for)

> I have tried the global field in Class, Registration, and in  
> holdVariable a one record table linked to Registration and to Class.

I'm guessing that is not your problem. It doesn't really matter where  
the globals are.

> Go to Layout [ "RegistrationReport" (Registration) ]
> Show All Records
> Go to Record/Request/Page
> [ First ]
> Loop
> If [ Registration_Class::ClassYear < Registration_Class::gFromDate  
> or Registration_Class::ClassYear > Registration_Class::gThruDate ]
> Omit Record
> End If
> Go to Record/Request/Page
> [ Next; Exit after last ]
> End Loop
> Sort Records [ Specified Sort Order: Registration::ProgramName;  
> ascending
> Registration::FKClassID; ascending ]
> [ Restore; No dialog ]
> Enter Preview Mode

HTH. If it doesn't, do confirm that this script works with those  
steps disabled and also let us know what you mean by 'doesn't work'  
-- ie you get the wrong report or you get a blank report or something  
else.

Steve

Reply via email to