How To: Usage of SETAUTOCALCFIELDS in NAV

Optimization2
FacebookTwitterGoogle+LinkedInWhatsAppEvernoteShare

One of the functionalities I personally feel most developers do not use and they should, for it adds performance to long lasting processes compared to its predecessor is SETAUTOCALCFIELDS.

This function was introduced in NAV2013 and is not available in versions priors to that one.

SETAUTOCALCFIELDS enables working with flowfields in a more efficient and proper way in loops and data searching structures.

For instance, we could replace the next piece of code:


Cust.RESET;

IF Cust.FINDSET THEN

REPEAT

  Cust.CALCFIELDS(Balance); // This is not as efficient 

  { more code here }

UNTIL cust.NEXT=0;

For something alone the lines of:

Continue reading