Use new IncStr parameter to change integers by more than 1 in string variables
Important
Some of the functionality described in this release plan has not been released. Delivery timelines may change and projected functionality may not be released (see Microsoft policy). Learn more: What's new and planned
Enabled for | Public preview | General availability |
---|---|---|
Admins, makers, marketers, or analysts, automatically | Apr 2025 | Apr 2025 |
Business value
For some time you've been able to increase a positive number or decrease a negative number inside a string variable by 1 using the IncStr method on Text types. This is useful when handling iterations, for example, involving number series. If you needed to make a change of more than 1, however, you had to write extensive custom logic. To help in these scenarios, the IncStr method now supports a new optional increments parameter to change more than 1.
Feature details
A new overload of the IncStr
method is added to support an arbitrary increase or decrease of a number in a string variable. This allows for incrementing number series or other similar series by more than one position in one go.
When decreasing a positive number, use a try
function to catch cases where the string can't be decreased further. Format-wise, when decreasing, leading zeros will be added as applicable.
The example shows incrementing the integer 99 in the AText
string variable to 109 in a single call, by using the new IncStr
method overload with an increment parameter of 10.
Tell us what you think
Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.