Solved

Set Flag in Crystal Reports

Posted on 2011-05-02
600 Views
I have a report that has 2 tables

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?
0

LVL 100

Expert Comment

Try this idea

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

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

mlmcc
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.
Sum({Category1}) > 0
use
Sum({Category1}, {Invoice_N}) > 0
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?

Thanks,
Mathew
0

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
Else
Sum({SoldItem.Cost}, {Invoice_N})

mlmcc

0

Author Closing Comment

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

thanks so much
0

Featured Post

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 (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…