How to add image in Business Central?

MortenSteengaardMortenSteengaard Member Posts: 136
edited 2020-10-06 in NAV Three Tier
Hi experts,

Hmm, I cannot find a category for "Business Central"-related questions. I hope it is OK to put my question here.

I have made my own extensions for Business Central Cloud (Sandbox): One new table and one new list page.

I want to show a picture on my list page (and maybe later on a new card page). And I want it to be possible for the user to insert a jpg-file, to change the file in BC and to delete the file in BC (= empty the field).

As I understand, Media or MediaSet are the best types to use in this case.

The problem is that the field is not at all visible on my list page.

What am I missing?

If I make a new list page with the field "Picture" from table "Company Information", I can see the picture and change it. It is a Blob-field. But if I make my own field of type Blob, then I can only see a plus sign on my list page and I cannot add my jpg-file to the field.
table 50100 CarBrand
{
    DataClassification = ToBeClassified;
    Caption = 'Car Brands';

    fields
    {
        field(1; "Car Brand"; Code[20])
        {
            DataClassification = ToBeClassified;
            Caption = 'Brand';
        }

        field(2; Description; Text[50])
        {
            DataClassification = ToBeClassified;
            Caption = 'Desc.';
        }

        field(3; "Picture of Logo"; Media)
        {
            DataClassification = ToBeClassified;
            Caption = 'Logo';
//            Subtype = Bitmap;
        }

    keys
    {
        key(PK; "Car Brand")
        {
            Clustered = true;
        }
    }
}
page 50100 CarBrand
{
    PageType = List;
    ApplicationArea = All;
    UsageCategory = Lists;
    SourceTable = CarBrand;
    Caption = 'Brands...';

    layout
    {
        area(Content)
        {
            repeater(General)
            {
                field("Car Brand"; Rec."Car Brand")
                {
                    ApplicationArea = All;
                    ToolTip = 'The brand';
                }

                field("Description"; Rec.Description)
                {
                    ApplicationArea = All;
                    ToolTip = 'Some desc.';
                }

                field("Picture of Logo"; Rec."Picture of Logo")
                {
                    ApplicationArea = All;
                    ToolTip = 'The logo';
                }
            }
        }
    }    
}

Best Answer

Answers

Sign In or Register to comment.