Report bypassing the detail line if the Amount is Zero

We have some shipping reports and the users don’t want to see the shipment detail lines if the amount is zero. We ship a lot of no charge items that have zero amounts.

Is there any way to code this report to check the amount and skip printing?

What it be put under Sales Line - OnAfterGetRecord() ??

Thanks in advance,

Greg

That would be in the OnPreSection trigger of the line body section. CurrReport.SHOWOUTPUT(FALSE) will not print the section, so you would do something like this:

CurrReport.SHOWOUTPUT(ABS(Amount) > 0);

Thanks Daniel.

That worked great unfortunately they added another stipulation where it would only include a “userid” of a certain employee so I need to add and “AND” to this statement. Something similar to this but it’s needs a little help.

CurrReport.SHOWOUTPUT(ABS(Amount) > 0) AND(userid) = “personsname”;

Hi Greg,

Just use a standard IF statement e.g.

If ( ABS(Amount) <= 0) ) AND (userid = “personsname” ) then

currreport.showoutput( FALSE );

Daniel I seem to be having a syntax problem with the “username”. I’ve tried putting just about everything I can think of with/without quotes… Still get the same message.

Thanks,

Greg

Hi Greg,

What is username - a text variable?

Userid is a system function that returns the ID of a user (have a look at the help).

Can you show us some code?

Hi Greg,

I think your code needs some more parantheses (or what ever it’s called [:D])

CurrReport.SHOWOUTPUT(ABS(Amount) > 0) AND (USERID = “Personsname”)
This code only includes the “ABS(Amount) > 0” part in the CurrReport.SHOWOUTPUT.

Add yet another set of parantheses around it all, and it should work like you want.
CurrReport.SHOWOUTPUT((ABS(Amount) > 0) AND (USERID = ‘Personsname’))

(btw… remember to use single quotation-marks to define text… not double)

I must add that i think it’s a very very bad idea to hardcode the username of the user who can’t print the 0-lines into the report.
Any other user will have the 0-lines printed.
Then the first user falls ill, then who can print the invoices to the customers?
Anyone? By logging in with the first users login?

I think you should either consider adding a field to some setup-table, in wich it can be setup wich user-id is to be used in this report.
Or maybe add a boolean-variable in the report, and have the user check/uncheck it in the request-form.

The username is the person in Accounting who is doing posting for non ship items and messing up the report.

The User ID is a field taken from table 110 Sales Shipment Header.

Thanks to all. It is fixed now. I was using double qoutes on the user’s name and switched it to single quotes and it solved the error.