Dynamics Business Central / NAV Developer Digest - Vol. 471

Dynamics Business Central / NAV Developer Digest - Vol. 471

ArcherPoint’s Developer Digest focuses on Microsoft Dynamics 365 Business Central and Dynamics NAV development. This week’s volume includes a workaround for running back-to-back reports in BC, the importance of clean code and test-driven development, when and how to use the blob data type, and a feature of the new Azure File Share module.

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.

A workaround solution for running reports back-to-back in BC

QUESTION: Has anyone run into issues printing two reports from code back-to-back? I’m working on a project where we print a sales shipment and then a sales invoice, and I can print one or the other, but not both. I see the reports running in the debugger, but for whatever reason, I can only get output from one of them. Has anyone else ever seen this issue? If so, how did you resolve it?

Andrew Warnica replied:  What we did was to remove the report in report selections, and then print both in code:

Clear(Report50000);

Report50000.SETTABLEVIEW(SalesInvHeader);

Report50000.RUN;

Commit();

Clear(Report50001);

Report50001.SETTABLEVIEW(SalesShipHeader);

Report50001.RUN;

Commit();

The user was presented with both reports with the option to Preview or Print, which was their request, (they didn’t want the ‘download’).

We could not present both reports as pop ups with report selections, only the second one (or last one if you have 3) prints. Seems like either a BC bug or just something that happens with the browser as the client.

The legacy of Uncle Bob: The importance of clean code and test-driven development

The other day, Jon Long posted:

Automated Testing has led me down a road to the re-discovery of Clean Code. If you can’t easily write a test for code, the code is likely dirty code. Dirty code is hard to review, hard to maintain, hard to add features to, hard to debug, and hard to improve.

TDD is the answer. Test Driven Development (TDD) enforces clean code.

If your testing is literally “driving” your development (TDD), your code by default becomes testable. And, testable code is clean code.

Anyway, now I’m Googling “clean code” and “TDD” and finding gems like this video by “Uncle Bob”. Really great stuff here. It’s long. Watch it during your builds and deployments.

Check out Uncle Bob’s video on Clean Code here.

To which Matt Traxinger added:

Uncle Bob (Bob Martin) is my hero, but I’m a nerd. If you want to go back in time, check out some of his old blogs, many of them are still surprisingly relevant.

Jon then responded:

Nice! “In my stilted view of the universe anything that impedes testing is something to be avoided. There are those who don’t agree with this view, but I’ll pit my defect rates against theirs any time. Testing considerations are very high on my list of important things, and I will gladly adjust my software designs to increase testability.” Uncle Bob, circa 2004.

Understanding the blob data type in Business Central

Alberto Sobén, the Business Central Geek, shows how the blob data type can be utilized in BC to handle different types of large binary data, such as documents, photos, XML, JSON, and other diverse data. Sobén walks through the basics of handling and leverage blob data, including how to delete, copy and edit. He also discusses the pros and cons of using media data types as opposed the blob data type.

Learn more about the blob data type capabilities in BC by reading Alberto Sobén’s blog, Blob Guide In Business Central In 2024.

Getting started with the new Azure File Share module

Stefano Demiliani is a strong believer in the new Azure File Share module’s ability to enrich file support in SaaS. Using the Azure File Share module, users can read and write files to an Azure File Share instance. And speaking of blobs, the use of the new Azure File Share AL module is similar to that of the the Azure Blob Storage AL module.

Read Stefano’s blog, Dynamics 365 Business Central: introducing the Azure File Share module, to learn more about the new Azure File Share module, including authentication and usage, as well as local drive integration.

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.

Trending Posts

Stay Informed

Choose Your Preferences
First Name
*required
Last Name
*required
Email
*required
Subscription Options
Your Privacy is Guaranteed