Editar

Partilhar via


Media.HasValue() Method

Version: Available or changed with runtime version 1.0.

Checks whether a Media data type field in a record has been initialized with a media object and that the specified media object exists in the database.

Syntax

HasValue :=   Media.HasValue()

Note

This method can be invoked using property access syntax.

Parameters

Media
 Type: Media
An instance of the Media data type.

Return Value

HasValue
 Type: Boolean
true if the Media data type field in a record has been initialized with a media object and the specified media object exists in the database, otherwise false.

Example

This example uses the HasValue method to iterate over the My Items table to determine whether media objects are available on records in the table.

The example assumes that My Items table exists and contains a Media data type field that is named Image. For information about importing media, see ImportFile Method (Media).

The code returns a message if a record does not include a media object.

 var
    myItemRec: Record "My Items";
begin
    if myItemRec.FindFirst() then begin 
        repeat begin
            if not myItemRec.Image.HasValue then
                Error('Item %1 does not have a valid image', myItemRec."No.");          
        end until myItemRec.Next < 1;  
    end; 
end;

Media Data Type
Get Started with AL
Developing Extensions