Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Skipping record based on calculated field

edited August 2002 in General
Greetings,

I have a need at runtime to skip a record/do not print a record if a
calculated field is of a certain value.

Any clues as to how to do this would be greatly appreciated. Maybe in the
beforeprint or beforegenerate event?

TIA,
Kevin

Comments

  • edited August 2002
    Thanks for the ideas!
    I can't modify the where clause as this is a calculated field using a
    lookup.

    I tried the following code and it doesn't seem to work.
    Is this what you had in mind?:

    procedure TrbCatalog1.ppDetailBand1BeforePrint(Sender: TObject);
    begin
    If SuppressTotals then
    begin
    If (plCatalog['Qty'] <= 0) then
    begin
    plCatalog.Skip;
    end;
    end;
    end;



  • edited August 2002
    Limit the dataset. Are you using DADE? If not, then add the calcfield in
    the WHERE clause to limit the dataset. If you are using DADE, then you'll
    have to wait until RB 7 which will support Calc fields as search criteria in
    DADE dataviews or skip the record when the detail band prints. The best bet
    is to skip a record by using the DetailBand.BeforePrint event to check the
    datapipeline value and calling the Skip method on the datapipeline. You can
    also use bookmarks to mark the records to print as show in the main report
    demo project in the data traversal settings group of reports #111-116


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited August 2002
    It is going to be much easier to try and limit the dataset. Can you create
    an inner join so that you can get the calc field as part of the single
    dataset instead of using a look up to get it? Then you can filter the
    joined dataset to get only the records that you want.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.