Jump to content


- - - - -

control break


4 replies to this topic

#1 Guest_Josef Derflinger_*

Guest_Josef Derflinger_*
  • Guests

Posted 10 June 2003 - 08:23 PM

I have a problem using variables as sort varialble in control break.
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
ctl brk:
-----------------------------------
2003
.....
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?

#2 Andy Jones

Andy Jones

    Member

  • Members
  • PipPip
  • 41 posts
  • Gender:Male

Posted 10 June 2003 - 10:36 PM

Hi Josef,

Sorry but it's not very clear what you are trying to do... :ermm:

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!

:rolleyes:

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?


Regards

Andy
Nothing is foolproof to a sufficiently talented fool...

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!

#3 Guest_Josef Derflinger_*

Guest_Josef Derflinger_*
  • Guests

Posted 11 June 2003 - 04:56 PM

If I have a set of records fields date and qty

5/11/2002 100
8/12/2002 100
12/30/2002 100
01/15/2003 100

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.
josef

#4 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,640 posts
  • Gender:Male
  • Location:Spain

Posted 11 June 2003 - 11:59 PM

Hi,

I did an example of this and it worked fine for me.

What version of ProIV are you on?

And can you post + attach your example for your function (ie .out file)?

Rob D.

#5 DARREN

DARREN

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 396 posts
  • Gender:Male
  • Location:Florida,USA

Posted 12 June 2003 - 02:21 AM

Josef,

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.
Things should be made as simple as possible, but not simpler



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users