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.
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
IF filename<>” THEN BEGIN
MediaID :=Rec.MyPicture.IMPORTFILE(filename,’Media Image’+FORMAT(Rec.PictureNo));
In tenant Media table following GUID will get inserted
Now Open the page in Web client and see the result
Following Media types are supported.
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