Category Archives: Tip 61 – 70

Tip #68 | Using Read-Scale Out in Business Central to improve Performance

Another quick tip for something I’ve used this week to help out a QBS partner with performance issues on Business Central.

Since the last release it’s possible to issue read-only commands on a real-time copy of your Business Central database by using the DataAccessIntent property.

This allows API Pages, reports and queries to be executed outside of your production database which is ideal for Power Apps, Power BI and websites that for example only show status information on outstanding orders.

Then I remembered, “off course” we can also use that with the ForNAV report pack for financial reports that run longer, like the Inventory to G/L Reconciliation. (Which already runs 10 times faster than the out of the box version).

So here is a screenshot:

DataAccessIntent = ReadOnly

And the documentation

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/performance/performance-developer#using-read-scale-out

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-dataaccessintent-property

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/database-read-scale-out-overview

IMPORTANT NOTE!!

You cannot use this for document reports! Document Reports in Business Central write to the database for logging purposes and VAT/Sales Tax calculation.

Document Reports are not good candidates for this feature since they are more or less WYSIWYG. They print litteraly what is in their source tables.

Also they leverage the Service Tier caching so they probably don’t even take a roundtrip to the database for most of the data they print.

Tip #66 | UTC Calculation

I have not blogged as much as I want to recently. Not because there is nothing to write about, but because I am so insanely busy.

However, today I ran into a question that required first Google and then Statical Prism to solve.

UTC Calculation in Dynamics NAV (Or Business Central)

This used to be cumbersome and required dirty tricks. Alternatively (and this is how I managed to solve it until today) you can setup a UTC service tier.

But, with the help of Prism I found that Codeunit 358 now has this code

[External] ConvertToUtcDateTime(LocalDateTime : DateTime) : DateTime
IF LocalDateTime = CREATEDATETIME(0D,0T) THEN
  EXIT(CREATEDATETIME(0D,0T));
DotNetDateTimeOffset := DotNetDateTimeOffset.DateTimeOffset(LocalDateTime);
DotNetDateTimeOffsetNow := DotNetDateTimeOffset.Now;
EXIT(DotNetDateTimeOffset.LocalDateTime - DotNetDateTimeOffsetNow.Offset);

So no more stupid workarounds, just use this instead.

Please hold on for more stuff on my blog. I recently converted one of my customers to SQL Azure with Windows Virtual Desktop, Azure Logic Apps, Blob storage & Azure Functions. So much to blog about. #ServerlessComputing

I’m also starting on a new contract next week that will help me multiply my skills in an efficient way. Very enthousiastic to try that out for the first time.

So hang on and keep coding….

Tip #61 | .gitignore for AL projects

The Business Central Community loves Git, but GitHub does not seem to even know we exist. It recognises our projects as perl projects and there is no suggestion for a .gitignore file.

Why .gitignore?

It’s generally considered best practice to use Git for managing uncompiled code, but not to store the result of a project, nor it’s dependencies.

Also, settings that may vary from developer to developer are best not to be stored since doing to would continously lead to conflicts with pushing and merging.

For AL projects this means we need to exclude our .app file (the result), the alpackages (our dependencies) and the vscode settings file.

Or if you want to copy & paste

.alpackages/
.vscode/
*.app

NOTE: You should create your .gitignore before the initial commit. Removing files later is a tedious process.