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;
See Also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈