Set Flag in Crystal Reports

Posted on 2011-05-02
Last Modified: 2012-05-11
I have a report that has 2 tables
Invoice LINKED TO SoldItems

I want to be able to look at all of the items sold on an invoice and if one of the items equals Category 1 I want a Flag that is set to True for all of the items in the Invoice.  If no items exist in Category 1 then the Flag shoudl be False for all Items.

How do I do this?
Question by:mschirad
    LVL 100

    Expert Comment

    Try this idea

    Create a formula
    Name - Category1
    If {CategoryField} = 1 then

    Use a formula like this for the flag
    Sum({Category1}) > 0

    LVL 22

    Expert Comment

    mlmcc has the right approach.  
    Assuming the report is grouped by {Invoice_N} you would need to tweak the last formula.
    Instead of  
    Sum({Category1}) > 0
    Sum({Category1}, {Invoice_N}) > 0

    Author Comment

    Thanks for your help.  IdoMillet - the second formula works.  I named this formula "Flag"

    I want to create another formula that looks at "Flag"

    If "Flag" = True then SoldItem.Cost / 2   (I want the cost for them items sold divided by 2)

    when I create my new formula that looks at "Flag" I get an error:  A summary has been specified on a non-recurring field.  

    Any suggestions?

    LVL 100

    Accepted Solution

    Formulas can be selected from the field list

    If {@Flag} = True then {SoldItem.Cost} / 2

    If the Flag formula uses a summary function then you can't summarize it.

    DO you want the entire invoice to be half or just selected items?
    For all items try

    If {@Flag} = True then
         Sum({SoldItem.Cost}, {Invoice_N})  / 2
         Sum({SoldItem.Cost}, {Invoice_N})  



    Author Closing Comment

    that was it.  I needed to use the formula in the summary and it's what I wanted.

    thanks so much

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now