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


Discover more from BCAIHUB — Business Central & AI Consulting

Subscribe to get the latest posts sent to your email.

5 responses to “Media Datatype-NAV2017”

  1. […] and then reference the media from application records. Media datatype provided better performance …read more Read Complete Post and Comments Tags: Media Datatype NAV 2017 web client […]

  2. Mohsin Abbas Avatar
    Mohsin Abbas

    Hi Amol.
    Is there any way of converting media to BLOB data type?

    1. Amol Salvi Avatar

      Do you mean to say media file to BLOB ?

  3. Nitesh Gangwar Avatar
    Nitesh Gangwar

    Hii, Amol
    how to convert MEDIA to BLOB
    any idea! please!!!

  4. Dan Yang Avatar
    Dan Yang

    Picture in BLOB field can be compressed. Is picture in Media field compressed? Thanks!

Leave a Reply

241,344 hits

Discover more from BCAIHUB — Business Central & AI Consulting

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from BCAIHUB — Business Central & AI Consulting

Subscribe now to keep reading and get access to the full archive.

Continue reading