Cannot see media and mediaset fields on card page

Hi experts,

I have made my own extensions for Business Central Cloud (Sandbox): One new table and one new list page. Using the list page, I open a new card page, I have made.

I am trying to find out what is possible with images in BC and therefore I have a few questions regarding the table and the card page, that I show below.

Question 1: Why is it only the "Car Brand" and the Blob field that are visible on my card page? The Media field and the MediaSet field are not visible at all, which makes it impossible for the user to put an image into these fields.

Question 2: Putting an image into my Blob field works fine. How do the user empty the field again? I would expect that to be a feature that I don't have to code myself.
table 50100 CarBrand
{
    DataClassification = ToBeClassified;
    Caption = 'Car Brand';

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

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

        field(3; "LogoMedia"; Media)
        {
            DataClassification = ToBeClassified;
            Caption = 'LogoMedia';
        }

        field(4; "LogoMediaSet"; MediaSet)
        {
            DataClassification = ToBeClassified;
            Caption = 'LogoMediaSet';
        }

        field(5; "LogoBlob"; Blob)
        {
            DataClassification = ToBeClassified;
            Caption = 'LogoBlob';
            Subtype = Bitmap;
        }
    }

    keys
    {
        key(PK; "Car Brand")
        {
            Clustered = true;
        }
    }
}
page 50104 CarBrandCard
{
    PageType = Card;
    ApplicationArea = All;
    UsageCategory = Administration;
    SourceTable = CarBrand;
    Caption = 'Car brand card';

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

                field(LogoMedia; Rec.LogoMedia)
                {
                    ApplicationArea = All;
                    ToolTip = 'LogoMedia';
                }

                field(LogoMediaSet; Rec.LogoMediaSet)
                {
                    ApplicationArea = All;
                    ToolTip = 'LogoMediaSet';
                }
                field(LogoBlob; Rec.LogoBlob)
                {
                    ApplicationArea = All;
                    ToolTip = 'LogoBlob';
                }
            }
        }
    }
}

Answers

  • txerifftxeriff Member Posts: 500
    edited 2020-10-20
    Hi,

    -try to do calcfields on the field. To ensure it has a value, use .hasvalue.
    -To clean image funny but I haven´t with blobs using images (I´ve always used for large texts) but if you assign a blank text should do or assign the blob field value from TempBlob table.
    -Mediatype can hold multiple images (read microsoft help). As I only needed one I had to use this piece of code ensure any other was removed:
                                   vCounter := 0;
                                    vPicCount := T27.Picture.Count;
                                    if vPicCount > 0 then
                                        repeat
                                            vCounter += 1;
                                            if t27.Picture.Item(vCounter) <> '' then
                                                T27.Picture.Remove(t27.Picture.Item(vCounter));
                                        until vPicCount >= vCounter;
                               
    
  • MortenSteengaardMortenSteengaard Member Posts: 136
    Hi txeriff.

    Thank you for your answer.

    I can only use calcfields method on flowfields and blob fields, so I cannot use it on my Media and MediaSet fields.

    But once again - thank you for your help.

    Best regards,

    Morten
Sign In or Register to comment.