# Skipping Records in a report

I have a table with employees and percentages. There are more than one percentage record for each employee. For example employee A has four records with four percentages. Percentage is to be calculated at run time and if the total is more than 100 then all those records (4) of that employee are to skipped. In other words this employee records should not be printed. How do I skip these records on a report. When I read these records they are already printed. Please help.

Which version of NAV you are using ?

What you have tries till now ??

Version 9, Classic

The problem is when I calculate those records at run time they are already printed and then I come to know if they are over or less than 100. Afterwards if they are over 100, I cannot skip the. Thanks for your help.

You can use Currreport .Skip by giving the condition .It will skip those record

Here is the problem: I get first record

Customer A, percent 4: Customer A percent 50: Customer A, percent 50

now 4 is not more than 100 so I let it print. Then I get the next record of customer A and the percent is 50. 4+50 is still not more than 100 and I let it print. Then next record percent of 50 is added to the total. Now the total percent is over 100. How can I go back and skip the records which already printed. Hope I made you understand?

Here is the problem: I get first record

Customer A, percent 4: Customer A percent 50: Customer A, percent 50

now 4 is not more than 100 so I let it print. Then I get the next record of customer A and the percent is 50. 4+50 is still not more than 100 and I let it print. Then next record percent of 50 is added to the total. Now the total percent is over 100. How can I go back and skip the records which already printed. Hope I made you understand?

Hi,

Your are right. We can’t use report skip function for previous printed record. You may need to use temp table for your report print and logic.

I hope you Will understand what mean.

Regards,

Yukon

Thanks. But this is the problem I am new and don’t exactly know how to use temp table. Can you please explain a little bit more.

Why do you need to read the individual percentage records if all you are looking for is their total? Sum the percentage records, related to the employee, and print or skip the employee based on the results.

Thanks. Let me try that.

let’s see

Let say your table name is employee then,

take record variable RecEmp, and 1 decimal variable let say TotalPercent

Try following code…

TotalPercent := 0;

RecEmp.SETRANGE(“Employee Name”,Dataitem.“Employee Name”);

IF RecEmp.FINDSET THEN REPEAT

TotalPercent += Dataitem.Percent;

UNTIL RecEmp.NEXT = 0;

IF TotalPercent > 100 THEN

CurrReport.SKIP;

Let try it.

Why loop thru all the records? Create a SumIndex on the appropriate key, set the filters and do a CalcSums.