Dynamics Business Central / NAV Developer Digest - Vol. 450
ArcherPoint’s Developer Digest focuses on Microsoft Dynamics 365 Business Central and Dynamics NAV development. This week’s volume includes BC debugging, revisiting the Knapsack problem, using Business Central’s HTTPClient.Post() method, and measuring developer productivity.
The Dynamics 365 Business Central community comprises professionals devoted to advancing the success of their customers. Developers, project managers, and consultants collaborate to share helpful information across blogs, forums, and social media sites. From discovering new solutions to finding answers to complex issues, these dedicated individuals are constantly sharing their knowledge with others. At ArcherPoint, we recognize and appreciate this highly engaged community’s creativity, hard work, and collective intelligence. To ensure all users can benefit from their expertise, we want to share their wealth of information with everyone.
Business Central debugging
Kyle Hardin posted the Developer Tip of the Week: Business Central Debugging
You can specify sessionId and userId in launch.json to debug a specific user’s existing BC session.
It has been around since BC20 or 21 and was the precursor for Snapshot Debugging, which lets us debug in the Production environment on SaaS.
Flashback: Revisiting the Knapsack problem
Matt Traxinger posted:
I feel like I have gone back in time today and used something I never thought I would use. Summer 2005…Georgia Tech…me sitting in CS3500 – Theory of Algorithms. It’s as dry of a subject as you would imagine it is. Think mathematical proofs of the execution speed of your code. One of the theories we learned about was the Knapsack problem. In short, you have a bag that can hold W lbs of weight, and you have N items. Fill up the bag with as many items as possible without going over its capacity. Eighteen years later, I have a use case. I have N items on a sales order that are set to be drop-shipped from an international location. In order to avoid certain fees, the PO for the items must not exceed W dollars in value (sales price). Split the order into as few POs as possible (fill up as few bags as possible). I’ll post a link to it once it’s in a branch that won’t disappear if anyone’s interested. In the meantime, here’s a snapshot of the code. I would gladly take feedback if you have any ways to improve it.
KNAPSACK SCREENSHOT
Tom Hunt replied: Now I’m a little nervous about those COBOL classes I took in college.
Kyle Hardin added: Sort them by density/weight/dollars first. Then, you can load the sack/PO in order until you get to your max. Unit Cost is your dollars-per-quantity density, so sort highest to lowest while filling your POs.
Matt Traxinger responded with: That was the original way we did it…the “cheap” version, and it does work most of the time. But there were a number of instances where it wasn’t what they wanted.
Example:
{ 1, 2, 3, 797, 798, 799 }, Max = 800
You’d get 4 POs like this if you sorted highest to lowest and filled up the sack.
{ 799 }
{ 798 }
{ 797, 3 }
{ 2, 1 }
When they only need 3 POs
{ 1, 799 }
{ 2, 798 }
{ 3, 797 }
Kyle Hardin answered with: Yes…yes, I see. And it would get even more complicated if you were allowed to split a single SO line across two POs. Still, I think I see how this can be done. The sorting is your starting point, but it then needs to go back down the availability list to pick up any smaller quantities that might fit. To minimize the number of POs, always fill up to the max, even if it means splitting SO quantities. Mark quantities as you go so as to avoid duplicates.
Tom Hunt added (with tongue firmly in cheek): I think you’ve missed the classic “Snake Oil Salesman” solution to this problem. You write something that hits their target 70% of the time, then when they complain about the edge cases, you say that they’re just not sophisticated enough to appreciate your 14th generation AI-powered SNOIS algorithm, and if THEY knew programming like YOU know programming, they’d understand. (I’m joking. Please don’t do this.)
Using Business Central’s HTTPClient.Post() method
Elyes Ferchichi posted, “Great article about Dynamics Business Central 365 HTTP client documentation that went live a few days ago. It provides code examples on how to upload a text file, a binary file, and large files using multipart/form data and much more. Very useful when working with APIs in the case of BC pulling and processing data from external systems.”
Read the article: HttpClient.Post(Text, HttpContent, var HttpResponseMessage) Method.
New Microsoft Certification Coming for Business Central Developer
Stefano Demiliani posted an announcement on Twitter that in January 2024, a new Microsoft certification exam will be available for Microsoft Dynamics 365 Business Central Developer. The certification exam will be in beta. Finally, a dev cert! He also notes that it will contain more than “pure developments stuffs.” Many developers are looking forward to earning this certification again. Matt T noted that it sounds like people will have to know some Git and how to really use VS Code.
Measuring developer productivity
McKinsey has developed an interesting approach to measuring, tracking, and benchmarking developer productivity. They claim that when this approach was applied in various industries, it reduced defects, improved the employee experience, and improved customer satisfaction.
Their approach uses three types of metrics: at the system level, the team level, and the individual level. These metrics include the DORA metrics (named for Google’s DevOps research and assessment team) and SPACE metrics (named for satisfaction and well-being, performance, activity, communication and collaboration, and efficiency and flow, developed by GitHub and Microsoft Research).
Read the article: Yes, you can measure software developer productivity.
Interested in Dynamics NAV and Business Central development? Be sure to see our collection of NAV/BC Development Blogs.
Read “How To” blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV and Dynamics 365 Business Central.