Inspired by a Microsoft Developer

Yes it happens.

When reading the C/AL code in NAV written by other developers you normally pick up smart way to do things.  Yesterday I got one.

In my solutions I have been using a function to check if a string is numeric and another function to extract the numeric value from a string.


All good and well.  Working fine so far.  But if you can write each function with a single line, would that not be better ?


Thanks for the inspiration Microsoft.

Series of improvements/enhanchements for Dynamics NAV 2016

During my preparation for Directions sessions I studied the new enhanced Data Exchange Framework in NAV 2016.  I have done a number of things to enhance the functionality and to enable functionality that should be available according to the possible setup.

Over the next coming weeks I plan to publish these things and hope that they will be useful for some of you.  How knows, Microsoft might even decide that some of these fixes and features should be included in the standard product.

The first thing I want to suggest is regarding the functionality of getting the XML structure of a file into the Data Exchange Framework.  Going into the definition for Yahoo Currency Exchange Rate Services and try the “Get File Structure” function.


Then next page will allow you to enter a URL to the XML file.


The problem we face here is that the Path must be accessible by the NAV Service Tier.  So, what to do if you have the XML file on your desktop?

Utilizing the new TryFunction method.  I decided to add the new function to the File Management Codeunit (419).


Throw any path; local path, server path, url to the MakeServerTempFile function and you will receive a Server File Name that is accessible by the Service Tier.  This function will

  1. If path if found on the server, return that path
  2. If path is found on the windows client computer, upload the file to the server
  3. Try to download the file with web client to the server
  4. Ask the user to upload the file

Add this function to Codeunits 1235 and 1237 to make sure that the Get XML Structure works as expected.