Dynamics Business Central / NAV Developer Digest - Vol. 467

Dynamics Business Central / NAV Developer Digest - Vol. 467

ArcherPoint’s Developer Digest focuses on Microsoft Dynamics 365 Business Central and Dynamics NAV development. This week’s volume includes ways to avoid record locking, finding problems in hidden fields, monitoring your Azure AI usage, and a filtering puzzle.

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.

Quick tip to avoid record-locking

Recently, Jon L posted:

I learned this from Waldo:

// OK - Results in a table lock, even if Rec is empty.

Rec.DeleteAll();

// BETTER - Bypasses a table lock if Rec is empty.

If not Rec.IsEmpty() then

    Rec.DeleteAll();

Kyle H replied: A similar tip – always use the parameter for FindSet. If you are just fetching to do a read-only loop, then do FindSet(false) to avoid a lock.

Jon added:

I did some testing for speed. I compared FindSet() to FindSet(true), traversed an Item Variant table with 530,000 records. Modified the description. I ran the test several times and they were identical in speed. However, the FindSet(true) held the lock for the entire time is was looping through updating the record. The findset locked it repeatedly, but released the lock between records.

So, while FindSet(true) may not show improvement in speed for a single procedure, you need to think about what the danger and ramifications your FindSet usage would have on other processes, or other processes upon yours. For instance, a single lock for 10 seconds or thousands of locks and unlocks within 10 seconds.

Can’t find the problem? Check hidden fields!

Brenda E. shared:

Here’s a helpful tidbit of information:

One of my clients asked me how to change his Work Date to default to the current date, as his work date is always showing 5/31/23. I searched and searched and couldn’t find anything online why this is happening. Thanks to our colleague Heinrich V, we found that the company information showed it is a demo company. The field is hidden, so we did a config package to change the Demo company setting from true to false, and voila! Problem solved.

Monitoring OpenAI usage can save on costs

Stefano Demiliani recommends using the Azure OpenAI Metrics Dashboard to monitor and control Azure OpenAI usage and costs. In addition to following key factors such as HTTP Requests, Tokens-Based Usage, PTU Utilization, and Fine-tuning, you can also follow useful metrics such as the total number of input prompt tokens processes, the number of tokens generated by the OpenAI model, and more – all of which can impact your AI costs. As Stefano puts it, “Using Azure OpenAI in the real world is not just sending prompts to a model, you need to carefully handle requests and monitor the underlying deployments.”

Read Stefano’s blog, Monitoring your Azure OpenAI usage to find out more.

Filtering is easy…until it isn’t!

Erik Hougaard has posed a conundrum to the YouTube developer community: Suppose you’re trying to filter on a field of Twitter handles. Each entry begins with an ‘at’ sign (@). However, most of the standard filtering techniques fail to filter just those entries and nothing more.

This article from Microsoft on Sorting, Searching, and Filtering in Business Central might offer some useful suggestions.

Watch Erik’s video, @ Filtering in Business Central, how hard can it be?, and, if you think you have the solution, submit your idea in the comments.

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