Maximum value from integer field.

How to get maximum value from integer field in Navision.

Is there any built in function for this.

Thanks and regards.

Hi Kami,

Have a read of the application developers guide - it’s in the download section if you don’t have one locally

I have written this code to get the maximum value from the field sequence. But it is not working and giving me value 0 every time. Even the highest value in the sequence field is 3.

MaxAmt := 0;
REPEAT
Amt := “itemlabel”.“sequence”;
IF Amt > MaxAmt THEN
MaxAmt := Amt
UNTIL “itemlabel”.NEXT = 0;

If sequence is not a flowfiled then the above code should work.

BTW, where did you write this code?

Hi Kami,

There is no find on the itemlabel record variable.

I would do this another way - add a key on the table for sequence and find the last record or use a flowfield.

If I write the above code in Codeunit without find also…it worked…thats why i asked where that code has been written…