Results 1 to 7 of 7

Thread: In crystal reports how can I .......

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384

    In crystal reports how can I .......

    I want to count the number of lines printed in the details setion of a group, not the total number - I have certain lines suppressed.

    I have a section suppressed if a=b and c=d
    So I have tried creating a count in the details section

    whileprintingrecords;
    NumberVar RecCount;
    if a=b AND c=d then
    RecCount := RecCount+1

    I am also resetting this variable to zero in the group header, but it just doesn't seem to be holding a count??????
    Mel

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    I know this is painfully obvious, but can't you just add

    WHERE a=b AND c=d

    in the record selection formula?
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    No because a; b; c .......... are other formulas evaluated on WhileprintingRecords ............ Anyway, I've gone past that.

    The problem now is:
    If I don't have any records appearing in the details setion - due to the suppression formula, I don't want the group header or footer appearing.

    I have a formula in my footer that calcuates the number of records that appears in each group. TROUBLE is that the formula isn't calculated until after the header is printed so it won't suppress the header.
    Mel

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Are your formulas based on database fields or some other criteria? You can create a Selection Formula for Groups (as well as Records) - maybe that is an option for you (ie throw out the groups/records beforehand so the suppression formulas are not needed.

    I don't know if this will work but have you tried using WhileReadingRecords?

    There is a topic in the help file called ReportProcessingModel that explains a litte how Crystal works, maybe it will give you some more ideas.

  5. #5
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    Over the years (I started with Crystal Reports 2 !!) I have made a number of 'rules' regarding the use of Crystal Reports and I pass these rules onto other developers as and when they seem necessary.

    They are:

    1. Switch off "Save Data with Report"
    2. Don't let Crystal do any work. Create a view.
    3. Work from the inside (details) out, not top to bottom.
    4. Just because it claims it can, it doesn't mean you should.
    ..

    (there are more, but I think that will give you all the information you need)
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    That's what I'll do then! Thanks
    Mel

  7. #7
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    I know it may mean a lot of work but VIEWs are so much more powerful than Crystal. We very rarely use formulae in reports these days - in fact we don't even join tables in reports - we just create a view that does everything we want and then get Crystal to simply 'pretty it up'.

    It makes it much easier in the long run. Trust me!

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width