ArcherPoint Dynamics NAV Business Central Developer Digest - vol 334
Upgrade Codeunits Running When Publishing an App to a Docker Container
Kyle asks: “Do upgrade codeunits run when you publish an app to a Docker container?”
Suresh responds: “Yes, it will run when you publish it.”
Len adds: “There is also a setting you can put in your launch.json: forceUpgrade: true.”
Figure 1 – Setting in docker container for running codeunits
When to Use the Clear Function
Len inquires: “On a curiosity side, how many out there use the "Clear()" function regularly? For records, I love it; it does a clear and an init. Things like boolean, text, code, integer, decimal, etc., I still use it all the time. A long time ago, I had someone tell me not to do that; it should only be used on records. This was WAAAAY back when. But, for instance, if I want to clear several vars, I will write:
as opposed to:
BoolVar := false; IntVar := 0;
Just curious what everyone thinks?”
Matt T answers: “I have never used Clear on anything other than a record variable. I actually didn't realize that it did an Init as well.”
Kyle adds: “The only things I use Clear with are records, arrays, lists, reports, and codeunits when I want any and all global variables reset inside those objects. I am also careful to close, dispose, and Clear any dotnet objects. Simple data types I set to zero, or space, or whatever the equivalent of null is.
Suresh continues: “I use it sometimes on the variables, and I have also used ClearAll in XmlPorts, and if you want to delete data from the blob or media field, then Clear is the way.”
Denise adds: “I use Clear a lot for records and variables. But I didn't know it did the init, so that's good info. TY!”
Kyle adds: “Keep in mind that there are performance reasons for why Clear, Reset, and Init all exist:
- Clear removes all filters regardless of filtergroup, sets each field to null, blank, or zero as appropriate, and then sets Init values for fields if that InitValue property is set for that table field.
- Reset removes all filters regardless of filtergroup but does nothing to any values in the record.
- Init sets each field to null, blank, or zero as appropriate and then sets Init values for fields if that InitValue property is set for that table field but does nothing to any filters that are set.
So, you as a developer should still be mindful of which of these commands is most appropriate and most efficient for what you are trying to do. You shouldn't go around hitting everything with a large Clear hammer.
Said another way, when your only tool is a hammer, all problems become nails.”If you are interested in Dynamics NAV and Business Central development, be sure to see our collection of NAV/BC Development Blogs. Read the "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV and Dynamics 365 Business Central.
- Login Error: Communication protocol mismatch between client and server
- Creating a Date Table in Power BI
- The Microsoft Technology Stack – What It Is and Why You Should Care
- The Top Eight KPIs Retailers Should Be Tracking (with Formulas) for Your Retail KPI Dashboard
- How to Make Measures Total Correctly in Power BI Tables