Serial No.

I want to add serial no in a list page, i have done using an integer variable as sr no and code is written on onaftergetrecord
sr no:= sr n0 +1;
its working
but no changes when i do export to excel using ctrl+e or by clicking the ascending or descending arrow in list page. I m using nav 2013 r2

hello,
Variables are not affected the table.
if you wish to sorting then you should create field and respective key

variables declared are only temporary on the page you cannot filter by them as they are calculated on the fly. If you are exporting using excel you will have to write a explicit code to calculate the value while exporting.

I don’t want sorting in serial no.

pastedimage1505994233308v1.png

but when i do sorting with No. field the serial no gets change.

pastedimage1505994417676v2.pngpastedimage1505994451708v3.png

Because you written code SN +=1;
means whenever trigger is fired, its increasing. you need to clear

I have cleared the variable on init but still not working.

Hello,

Best Idea is create Temporary variable of page source table.

In OnOpen Trigger filled this Temporary record with data by increasing one and then GET this Temporary record in onafterGerRecord trigger.

design your page with this filled.

see the below screenshot.

in your case you can use any Intger field of your table.

which table is this “TempInspectionresultLine” ???

how can i create a Temporary variable of page source table

Design your page

See below screen shots:

My Source table is employee table.

Then Declare Temporary record variable of Employee and use “Total Absence (Base)” field for increasing the value.

its a decimal field, you can also use.

still not working i have written code like this

SRN is my integer variable.

in OnAfterFetRecord, you written wrong code,
//Get function is working based on Primary key, but you use like setrange.

below are correct format as per your code.
RecIntTemp.RESET;
RecIntTemp.SETRANGE(Status,RecIntTemp.Status::Active);
IF RecIntTemp.FINDSET THEN;

[deleted]

Hello Seema,
I written code in OnAfterGetRecord Trigger, see earlier screenshot.

and i tested in my test DB, its working.

i tried also on aftergetrecord

i have written the code onaftergetrecord

Hello,

Instead of “Total Absence (Base)”, use TempEmployee.Extension, Actualy “Total Absence (Base)” is a flowfield, that’s why u got like that.

see below screenshot

in page design add, TempEmployee.Extension for SN

Just before the REPEAT set the SRN := 0;