Please can you help me understand what is going on with my report. I don’t really get the point.
I have a report and the first column should generate a progressive Number ( 1,2,3,4,5,…)
What I have done:
Create a global variable No.
On Trigger OnPreDataItem() of the report i declare first No as zero:
No := 0;
On OnAfterGetRecord() trigger i increment it by 1:
No := No + 1;
Save and Compile
The result i get is as below: PS: A strange thing that i don’t get. Is not the first time I create a progressive no. In other reports the result is ok.
First make sure No is not a field in the table from your driving table of your report that will completely throw off the report, declare a variable something like EntryNo, secondly you are incrementing the No OnAfterGetRecord which means no matter what your setrange condition is met or not it will increment the No. You will have to increment the No within your setrange which means only if the condition is met you are incrementing the No. Looks like when you are printing the record the variable No has run some many times that is why you are getting these weird nos.
Declare 1 variable called EntryNo or DocNo type Integer
OnPredataitem set Entryno or Docno to := 0;
Declare 2 variables PostingDate type Date and BilToPaytoNo Type code 20. On AfterGetRecord of the dataitem you will put a code
If (PostingDate <> record.Posting date) and (BilltoPaytono <> record.“bill-to/pay to no.” then
Entryno := Entryno + 1
On the last line of OnAfterGetrecord add the code
Postingdate := record.Posting date
BillToPayno := record.bill/to payno.
This way you are incrementing your entryno only when the group changes, otherwise don’t increment. Print your Entryno and then it will come in sequence.