Fetch Filename from Directory using DotNet Datatype-NAV 2017

During recent implementation got task to fetch the files from specified directory to import in tables using XMLPORT and I was using NAV 2017.

Now in classic version we were able to use FILE and this virtual table was giving us the list of files in specified path by using required filters and we were able to import data from multiple files.

Coming to latest version to find the files in directory I used DotNet variables as follows

From one of the folder I am fetching the filename as follows

folder1

Define the variables as follows

Name             Data Type               Sub type                                                       Length
gvDirectory  DotNet                      System.IO.DirectoryInfo.’mscorlib’
gvFile             DotNet                      System.IO.FileSystemInfo.’mscorlib’
gvArr              DotNet                       System.Array.’mscorlib’
i                        Integer

In one codeunit write following program

gvDirectory:=gvDirectory.DirectoryInfo(‘E:\WorkingFolder\Target\’);
gvArr:=gvDirectory.GetFileSystemInfos();
FOR i:=0 TO gvArr.Length-1 DO
BEGIN
gvFile:=gvArr.GetValue(i);
Name:=gvFile.Name;
END;

Message(Name);

 

message

 

This will help in importing the multiple/sequential’s files in tables using XMLPORT.

Let me know yours feedback.

Cheers

 

Advertisements

Cumulative Update Summary-Feb 2017

updateimage

Following is summary for cumulative update release in month of February

The cumulative update is intended mainly for solutions that are experiencing the problems described in the Knowledge Base article linked to below. However, you are advised to always keep your solution updated with the latest cumulative update. If you are in doubt about whether this cumulative update addresses your specific problem, or if you want to confirm whether any special compatibility, installation, or download issues are associated with this cumulative update, support professionals in Customer Support Services are ready to help you.

Download Cumulative update from following

NAV 2013 CU 47  Build No 47667  download from NAV2013 CU47

NAV2013 R2 CU40 Build No 47662 download form NAV2013 R2 CU40

NAV2015 CU 28 Build No 47871 download from NAV2015 CU28

NAV 2016 CU16 Build No 47864 download from NAV2016 CU16

NAV 2017 CU3 Build No 15140 Download from NAV2017 CU03

Warning

Before you install a cumulative update in a production environment, take the following precautions:

  1. Test the cumulative update in a non-production environment.
  2. Make a backup of the system or computer where the cumulative update is to be installed

Microsoft MVP Award Update

mvp

Microsoft made significant changes in MVP award program and now it will be awarded every month .

More information on following blog written by Steve Guggenheimer, corporate vice president of Microsoft’s Developer eXperience & Evangelism (DX) group

https://blogs.msdn.microsoft.com/stevengu/2017/02/01/continuing-the-evolution-of-the-mvp-award/

 

Anyway I am still waiting for my first MVP award. 🙂

 

 

Media Datatype-NAV2017

In this blog will try to explain how Media data type works in NAV2017 for uploading media,image.

Media data type store media in system tables of the database and then reference the media from application records. Media datatype provided better performance than traditional BLOB datatype. With BLOB datatype ,media is rendered every time in the client ,Media datatype provides unique Media ID to provide the data to client.

Table fields support data types for adding media to records. You can import media directly to a record . This media will get store in the system table Tenant Media with the unique identifier (ID). 

The media data type is associated with single media.

HOW TO USE MEDIA DATATYPE

Following example illustrate how to use Media data type in development.

Table

Field Id Field Name Data type
1 PictureNo Integer
2 MyPicture Media

Create list page and card page with above fields

Create one Action button on Page for importing the image.

Define following variable

filename   Text   250

MediaID   GUID
filename:=’E:\Photo.jpg’;
IF filename<>” THEN BEGIN
MediaID :=Rec.MyPicture.IMPORTFILE(filename,’Media Image’+FORMAT(Rec.PictureNo));
MODIFY;
END;

In tenant Media table following GUID will get inserted

tenant

Now Open the page in Web client and see the result

 

Following Media types are supported.

  • BMP
  • EMF
  • EXIF
  • GIF
  • JPEG
  • PNG
  • TIFF
  • WMF

You can use this method for applications that are developed for the Microsoft Dynamics NAV Web client and Microsoft Dynamics NAV Universal App:

  • Display media with records in list type pages, when the page is viewed in the Brick layout.
  • Display media on a card type page for a record.
  • Display media in a report.

 

Keep testing and let me know your feedback

Cheers….