How to Use SetLoadFields in Business Central?
SetLoadFields is a wonderful characteristic of business central wave 2 2020. Conventionally, we are used to load all fields data together whenever we fetch records from table. At that moment, I think it fires a Select * From Table query in the background. So, it will take little bit more timing in retrieving the data. We can reduce this time with the help of SetLoadFields when we use this function. I suppose it will use Select Field From Table query to fetch the data. This will impact a lot as far as performance is concerned. Also, we can use SetLoadFields with Setrange and Setfilter to get our desire records. Here, I have used Setfilter along with SetLoadFields.
There are other functions that can be used for Partial records capabilities but I guess SetLoadFields is the most important for developer like us.
Try running your code with/without the use of SetLoadFields. Then you can see the SQL statements in the database statistics part of the debugger
ReplyDelete