Dynamics Business Central / NAV Development Developer Digest - Vol. 425

Dynamics Business Central / NAV Development Developer Digest - Vol. 425

ArcherPoint’s Developer Digest focuses on Microsoft Dynamics 365 Business Central and Dynamics NAV development. This week’s Developer Digest vol. 425 covers a problem importing CSV files, adding a QR code to a report, app.json version conflict, and turning on features with code.

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 the creativity, hard work, and collective intelligence of this highly engaged community. To ensure all users can benefit from their expertise we want to share their wealth of information with everyone.

In this weekly digest, we present a collection of thoughts and findings from Dynamics NAV/BC experts and devotees worldwide each week. We hope these insights will benefit you, too.

Problem Importing CSV Files into Business Central

This question recently came to light: “I’m using the CSV Buffer to import and process a CSV from a customer. The way to import into the buffer is to call the LoadDataFromStream(InStream, ‘,’, ‘”‘) procedure after calling an UploadIntoStream. The LoadDataFromStream takes 2 or 3 parameters.

  • the instream
  • the delimiter (a comma in this case, it is a csv after all)
  • a “Character to Trim” (this is the double quotes that wrap fields that have commas inside of them)

In the CSV Buffer Table #1234, when each line is processed, Microsoft looks for the Index of the next comma or delimiter without paying attention to the “Character to Trim” until after they’ve processed what they believe is the value. So, if I have a line with the number “1,000” in one of the fields, it will be processed as 2 fields: 1 and 000. Has anyone run into this before? Did you have to re-write your own version of the CSV buffer?”

After much discussion, the final answer came from Matt T: “The problem is that there shouldn’t be commas in the middle of values in a CSV file. This probably occurred when someone imported a CSV file into Excel and then exported it out from Excel as a CSV file, preserving the Excel formatting. Using tabs or some other delimiter is almost always a better choice.”

Adding a QR Code to a Report in Business Central 18

Heinrich Vermeulen offered this handy tip: “I’m sure several people have done this, but here is a quick way to add a barcode to a purchase order. Add a text box on the report layout using the font ‘IDAutomation2D’ and set an appropriate font size referencing the field as the source. This was added in BC18 (2021 Wave 1):”

Figure 1 – Adding a QR code to a report in Microsoft Dynamics 365 Business Central

Kyle asks: “Are QR codes straight text, or do they need encoding like 3 of 9 or MICR?”

Heinrich replies: “They need encoding. The IDAutomation font that comes out of the box with BC SaaS is used for 5 different 2D barcodes, and you need to specify the symbology as part of the encoding. It’s not as simple as 1D. The 1D fonts have specific fonts for each encoding type. Look at IDAutomation.com > Barcode Fonts for more details.”

Sandbox vs. Docker Follow-up: app.json Version Conflict

Kyle asks: “I have a follow-on question to the container/sandbox question (see the discussion about BC SaaS Development and Testing in Dev Digest 421 for the original discussion). I create my own dev sandbox, a copy of a customer’s production environment. Then I try to publish from VSC whatever code change I just made. The publish fails because my local app.json has version, and the sandbox has whatever was last published to production as 21.4.20230201.79006. If I change my app.json to, I can now publish, but it also means that every git commit I do wants to include app.json, which will mess up the actual DevOps builds. How is everyone working around that problem?”

Matt T answers: “This does not affect the build.

  • Major Version = The major version of the container the app is built on
  • Minor Version = The minor version of the container the app is built on
  • BugFix Version = The date in YYYYMMDD format
  • Build Version = The build id from Azure DevOps

Again, the version in app.json has zero effect on the version produced by DevOps. I usually just change the date to today’s date and put the build version at zero when I have a local conflict.”

Developer Tip of the Day: Turning on Features With Code

Kyle offers this tip: “This article (probably) only applies to OnPrem. I’m working in BC20, and the Power BI/Automate Feature (in Feature Management) only has a Try Once option, and then it only works for a single session in a single web page instance. I figured out how to turn it on for real, but it involves code, and you have to work around the new (horrible) interface restrictive model:

FeatureKey: Record “Feature Key”;
FeatureDataUpdateStatus: Record “Feature Data Update Status”;
FeatureManagementFacade: Codeunit “Feature Management Facade”;
FeatureKey.”Can Try” := false;
FeatureKey.Enabled := FeatureKey.Enabled::”All Users”;
if not FeatureDataUpdateStatus.Get(FeatureKey.ID, CompanyName()) then begin
FeatureDataUpdateStatus.”Feature Key” := FeatureKey.ID;
FeatureDataUpdateStatus.”Company Name” := CopyStr(CompanyName(), 1, MaxStrLen(FeatureDataUpdateStatus.”Company Name”));
FeatureDataUpdateStatus.”Data Update Required” := FeatureKey.”Data Update Required”;
FeatureDataUpdateStatus.”Feature Status” := FeatureDataUpdateStatus.”Feature Status”::Enabled;
if FeatureDataUpdateStatus.Insert() then;
end else begin
FeatureDataUpdateStatus.”Feature Status” := FeatureDataUpdateStatus.”Feature Status”::Enabled;
FeatureKey.”Can Try” := true;

Save the Date: Business Central 2023 Release Wave 1 Launch Event – March 29-31, 2023!

Want to learn about the latest innovations for Business Central? Hopin will host a free webinar series featuring product leaders covering the new features and capabilities of Business Central. It all starts on Wednesday, March 29. Learn more about the Business Central 2023 Release Wave 1 Launch Event!

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
Last Name
Subscription Options
Your Privacy is Guaranteed