NEXT function with FIND or FINDSET

The syntax defined for the NEXT function follows:

IntegerValue := Record.NEXT ( ReadStepSize )

The full assignment statement format is rarely used to set an IntegerValue. In addition, there is no documentation for the usage of a non-zero IntegerValue. When IntegerValue goes to zero, it means a NEXT record was not found. In early versions of NAV 2017, the Help text for NEXT does not properly explain the use or value setting for IntegerValue.

If the ReadStepSize value is negative, the table will be read in reverse; if ReadStepSize is positive (the default), then the table will be read forward. The size of the value in ReadStepSize controls which records should be read. For example, if ReadStepSize is 2 or -2, then every second record will be read. If ReadStepSize is 10 or -10, then every tenth record will be read. The default value is 1, in which case, every record will be read and the read direction will be forward.

In a typical data-read loop, the first read is a FIND or FINDSET function, followed by a REPEAT-UNTIL loop. The exit condition is the expression, UNTILRecord.NEXT=0;. The C/AL for FINDSET and FIND('-') are structured alike.

The full C/AL syntax for this typical loop looks like the following:

IF CustRec.FIND('-') THEN 
REPEAT
Block of C/AL logic
UNTIL CustRec.NEXT = 0;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.239.195