Customizing Dynamics NAV
Discover different ways to customize the application to give you and your colleagues access to the features, functionality, and data that you need most.
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants.Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements.
ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
I've prepared this blog post because of only few of people which I asked known about this feature, and I decided that "world should know about it". This example actual for both languages - AL and C/AL.
Most of us use data import from XML files. Directly or from API response messages.
And I bet, that most of you faced with a problem of converting XML values to NAV data types.
For example - XML date, which is YYYY-MM-DD. If you try to use EVALUATE(NavDate, XMLDate) - you'll get an error.
I saw different convert functions like this:
It's working but it's not a clean code.
It's not obvious, but EVALUATE function has 3rd non mandatory parameter:
[Ok :=] EVALUATE(Variable, String[, Number])
And we see that it could have the only value:
This optional value can be used when exporting data with an XMLport. The only valid value is 9, which indicates that the data must be converted from XML format to C/SIDE format.
So we could just use this, and get the needed result:
EVALUATE(NavDate, XMLDate, 9);
The same way we could use with decimal values if your country has decimal places delimeter not equal to dot "." In Russia we use comma "," delimeter and EVALUATE(NavDecimal, XmlDecimal) - also throws an error. I saw next code:
EVALUATE(NavDecimal, CONVERTSTR(XmlDecimal, '.', ','));
But the correct way is:
EVALUATE(NavDecimal, XmlDecimal, 9);
Hope, this post was helpful for you!
Business Applications communities