Print data in a Report

I have 3 variables print in Report, on a record line.

When the 3 variavles on the same time are = 0, I want that record not be printed.

These variables are calculated on Purch. Rcpt. Line - OnAfterGetRecord(). So, after get all Variables value I woud be ready for the print condition.

I tried:

On Purch. Rcpt. Line - OnAfterGetRecord(), on DataItem

IF(a= 0 and b=0 and c= 0) THEN

CurrReport.SKIP;

on Purch. Rcpt. Line, GroupFooter (1) - OnPreSection()

CurrReport.SHOWOUTPUT, but this does not work, because I can have in a record one of variables = 0…

My question is

How avoid recor be printed, when all 3 variables on the same time = 0.

Thanks

Try looped If else

Sorry, I don’s understand :frowning:

Try to write 3 if else conditions like

If (a=0) then begin

if(b=0) then begin

If (c=0) then begin

CurrReport.SKIP;

end;

end;

end;

by the way I have used same code as you have done in 1 try and it works fine for me

In My case does not Work.

My variables are printed in a Group Footer section, because they are Total variables…

I pur your idear on Purch. Rcpt. Line - OnAfterGetRecord()

where my variables are created, but does not work :frowning:

Define an boolean variable and make its value set to false if all 3 variables are zero and then GroupFooter (1) - OnPreSection()

CurrReport.SHOWOUTPUT(Defined Variable )

You probably just got your SHOWOUTPUT conditions wrong. They would be different for skipping.

IF ((a = 0) AND (b = 0) AND (c = 0)) THEN
CurrReport.SKIP;

or

CurrReport.SHOWOUTPUT := ((a <> 0) OR (b <> 0) OR (c <> 0));

It’s easy to get the ANDs and ORs mixed up sometimes.

Hy

I have this solution in Purch. Rcpt. Line - OnPostDataItem()

IF ((a = 0) AND (b = 0) AND (c = 0)) THEN
CurrReport.SKIP;

the report skips this records, but print anyway :frowning:

WHY??

Because it’s in OnPostDataItem. That trigger fires after all of the records have already processed. You need to put your code in the correct trigger.

I’m a bit confused. Do you mean you don’t want the groupfooter line to be printed only wether at least one of your three variables is not 0?

If so, you need to set the SHOWOUTPUT function to FALSE when all the three are variables are 0, in Purch. Rcpt. Line, GroupFooter (1) - OnPreSection(). Did you try this? What code did you exactly write? It’s not clear from your post

No, that is not the situation…

I want the groupfooter line to be printed, only if all 3 variables on the same time are equal to 0. If that happens, the record “Purch. Rcpt. Line”.“Document No.” must not be printed.

And on

Purch. Rcpt. Line - OnPostDataItem()

only at this moment I have the variables value, so

IF ((a=0) AND (b=0) AND (c=0)) THEN

CurrReport.SKIP;

But with this solution, the record is skiped, but printed anyway :frowning: And I don’t want it.

Regards

You can only skip in the OnAfterGetRecord trigger.

Why can’t you put CurrReport.SHOWOUTPUT( (A=0) AND (B=0) AND (C=0)) in your OnPreSection trigger?

I was trying to ask the same question respecting Matt’s signature quote… [;)]

Matt

But CurrReport.SHOWOUTPUT( (A=0) AND (B=0) AND (C=0)) in your OnPreSection trigger, it’s jus what I don’t want. With this solution only all records a= o and b=0 and c= 0 will be printed, and I want precisely the oposit.

Do you know how to deny this? In Logic math I know…but does not solve my Problem :frowning:

I forgot to copy argh!
2nd try.

If if does the exact opposite of what you want it to do then it should be easy to figure it out!

How about changing your code so it’s more readable for you.
if a=0 and b=0 etc… then currreport.showoutput(false) else currreport.showoutput(true)

I think you might be overcomplicating this.

Thanks

This is the finally solution. Sorry if I wasn’t objective in mey question.

Thanks

What I usually do is add extra group footers and each one gets it’s own Curreport.SHOWOUTPUT filter…