[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] Re: New-report data and report name do not match



On Mon, Dec 12, 2005 at 05:24:22PM -0500, Whitaker-Freitas, Elizabeth wrote:
> Greetings.  I'm at a complete loss.  I'm trying to create a new pdf for
> each Class Year based on the query below.  The code as is creates
> individual pdfs, however, the pdf file 1999asr.pdf contains the data for
> Class_Year = 2000 and 2000asr.pdf contains the data for Class_Year =
> 2001.  I see how the data is going to the wrong file, as there is also a
> file created called "asr.pdf" that contains the data for 1999.  
> 
> What am I missing?

You are trying to use the SAVE= variable in your BEFORE= procedure...
but SQR does not "guarantee" that assignment will have happened when the
BEFORE= procedure. Instead, you should just use the "original" variable
(in this case, the &class_year variable from your begin-select list).

> !Create new file for each class year
> BEGIN-PROCEDURE NEWREPORT
>    let $newreport = $class || 'asr.pdf'
>    New-Report $newreport
> END-PROCEDURE

So, if you just change this procedure to say
  let $newreport = &class_year || 'asr.pdf'
, it should work the way you want.


I'm attaching a demo program that shows how the SAVE= variable is not
updated until *after* the BEFORE= procedure, at least for the first
record coming out of the database.

(Also note that in the body of the select &table_name and
$table_name_save always have the same value, so you might as well just
use the "original" variable &table_name there as well, to avoid
confusion.  Only in the AFTER= procedure do the two differ; that's the
situation where you need to use the SAVE= variable in order to know the
old value of the variable, since the new value has already been put into
the & variable)

                                                        Nathan

p.s.  What version of SQR are you using?  At leat in v6.2 and v8, I
would expect your current program to create "asr.pdf" with the 1999
data, but then to actually work okay for the later class years.  In
other words, I think using &class_year instead of $class is necessary
and it might fix everything, but I'm wondering if something else is
going on in your case as well.  (Is the program listing you sent out the
complete listing for the program you are running?)

----------------------------------------------------------------------------
Nathan Stratton Treadway  -  nathanst@ontko.com  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users