Hello,
There are multiple ways to solve this problem.
I will explain two ways that will allow you to solve this problem but also other problems when designing the report.
I assume your table has a boolean field ISDISCOUNT that is true if the line has a discount, but you can replace YOURTABLE.ISDISCOUNT with any boolean expression to check the discount.
One way to solve the problem is the following:
1.Create a parameter called HASDISCOUNT, integer width value 0. Invisible to user.
2.In after print operation of the amount, or the quantity, or whatever is always printed (for each line) place the expression:
M.HASDISCOUNT:=MAX(M.HASDISCOUNT, IIF(YOURTABLE.ISDISCOUNT,1,0))
This will assign 1 to HASDISCOUNT if already is 1 or 1 if the line has a discount.
3.Place the printcondition: M.HASDICOUNT=1 in the lavel
This way is more debuggable as you can print an expression M.HASDISCOUNT, in the detail to see the evolution of the variable over multiple lines and the same at the header and footer to debug the process.
Note: If multiple "invoices" are printed in one report you should place the expression M.HASDISCOUNT:=0 after printing the final footer or at the first header of the invoice to reset the variable.
Other different way is to use expression identifiers, this is also useful to operate with calculated aggregated expressions, and I think the is the way you are looking for:
1.Place an expression at the footer.
Expression: IIF(YOURTABLE.ISDISCOUNT,1,0))
Aggregate: Group
AggregateGroup: YOURGROUP
AggregateType: MAX
2.Check the expressions prints 1 in invoices with discount and a 0 in others.
3. Set the identifier property to something like: INVOICE_HAS_DISCOUNT.
4. Place a label, with your text and in the print condition set the expression: M.INVOICE_HAS_DICOUNT=1
5. Once it works you can make the expression at step 1 invisible using a print condition of false.
To access aggregated values from expressions you must place an identifier, that variable will contain the aggregated value at each moment in the report calculation.
Thanks