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….

Advertisement

5 thoughts on “Media Datatype-NAV2017

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.