Posted 10 June 2003 - 08:23 PM
Using a varialbe $year - lets say 2002 (derived from a date (06/3/2002)) I get an incorrect printout.
ex: joe 05/15/2001 100
frank 07/11/2001 200
ctl brk: 2002 310
paul 6/2/2002 110
Basically the break occurs when a date from the new year is processed, the control break prints that record already include, even the break is about the old year. How do I handle this correctly?
Posted 10 June 2003 - 10:36 PM
Sorry but it's not very clear what you are trying to do...
Could you give us a little more information on your data, how you defined the control break and what it is you are expecting to be printed out? Are you developing in Native, Developer Studio, VIP or Superlayer?
Just a guess - but are you trying to print the total at the end of each years data?
Were you expecting the first control break to say 2001 300 and not 2002 310 ?
If you are printing totals, are you using Vertical Totals (VT) or adding them up yourself in logic - and if so, in which logic?
The more information you can give us about your function, what it is doing and what it should be doing, then the more likely it is that someone can help!
If you are not getting the data from the 'last' record of the year, but the 1st record from the following year, that suggests you are using the CB Header Next and/or CB Logic Next fields on your control break. These two use will the data from the 'next' record (2002) and not the 'last' record (final 2001 record). To use the 'last' record's values, use the Before CB Logic or CB Logic point and the CB Header. Could this be the issue?
Don't learn from your own mistakes - it's safer and more entertaining to learn from the mistakes of others!
Just because you can, it doesn't mean you should!
Posted 11 June 2003 - 04:56 PM
I sort by date, set my variables at read no error ($yr = cdate(date,'yyyy'), #qty += qty
my control break is at $YR, I print header 1 which does nothing but print $YR #qty
at my break I get 2003 400 when I really want to get 2002 300.
Hope this is more clear.
Posted 12 June 2003 - 02:21 AM
From what you are saying, the control break is happening one record after it really should. This is because the record that caused the CB has already been read and processed. To achieve the desired result, CB's should be employed on either the key field(s) of the primary file and/or the sort variables. Try moving the line of code that sets the $YR variable to the sort select logic and sort on that variable as well.
Reply to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users