Using Partial Records in Business Central - CloudFronts

Using Partial Records in Business Central

Introduction:

Business Central allows us to load records partially, i.e. only certain fields from a table which can be defined by the User. As this requires less data to be pulled out from SQL and similarly less data to be sent over the network, using partial records provides a significant performance gain. Even more so if the table has multiple extensions attached to it. The methods for partial loading are also available on Record References.

References:

Partial Records – Business Central | Microsoft Docs

Record.SetLoadFields Method – Business Central | Microsoft Docs

Usage:

There are two groups of methods which we can use for Partial Loading.

First, which set the Fields to be loaded prior to fetching the records and secondly which load the fields after the initial fetching.

  • SetLoadFields – It is used to specify the fields which are to be loaded when the record is to be fetched using the “GET” or “FIND” procedures. Reusing this on the same record variable leads to resetting of the fields to be loaded.
     
  • AddLoadFields – It is used to load another field, in additional to the fields that have been loaded. Calling this Procedure repeatedly on a record does not lead to resetting of the fields that are to be loaded.
     
  • AreFieldsLoaded – It is used to check if the fields mentioned are loaded already or not.
     
  • LoadField – It is used to load more fields in addition to the fields that have been loaded already. To load the fields it uses a technique known as JIT Loading.

Conclusion:

Thus we saw how we can make use of partial loading of records with minimal code in Business Central!

As a side note, I would like to mentioned that it is not recommended to use a partially loaded record for Insert, Update or Delete operations as these operations require a record will all fields loaded.


Share Story :

Secured By miniOrange