Skip to main content

Notifications

Business Central forum
Answered

I Want a Way to Retrieve An Image From a Field In The Report

Posted on by 40
hi Thank you all for always helping me

I have a question: I want a way to retrieve an image from a field that contains an image and I want to retrieve the image in the report
 
use Microsoft SQL Builder
 
First, I created a new report called "Shipment_Brief"
*****************************************************************************************
table 50020 "Shipment_Brief"
{
    DataClassification = ToBeClassified;
    fields
    {
       
        field(11; "Palletization Table"; Text[100])
        {
            DataClassification = ToBeClassified;
            Caption = 'Palletization Table & Instructions';
        }
        field(12; "Palletization Table Att"; Blob)
        {
            DataClassification = ToBeClassified;
            Caption = 'Palletization Table & Instructions Attachment';
            Subtype = Bitmap;
        }
    }
}
*****************************************************************************************}
Secondly, I created a new Page "Shipment Brief Card"     
 
page 50021 "Shipment Brief Card"
{
    PageType = Card;
    SourceTable = "Shipment_Brief";
    ApplicationArea = All;
    Caption = 'Shipment Brief';
    UsageCategory = Administration;
    SaveValues = false;
    layout
    {
        area(content)
        {
            group(Group1)
            {
                Caption = 'Palletization Table & Instructions';
                field("Palletization Table"; "Palletization Table")
                {
                    ApplicationArea = All;
                    Editable = true;
                }
                
                field("Palletization Table Att"; "Palletization Table Att")
                {
                    ApplicationArea = All;
                    Editable = true;
                    trigger OnAssistEdit()
                    var
                        InStream: InStream;
                        OutStream: OutStream;
                        FileName: Text;
                        BlobSize: Integer;
                        BlobData: Text;
                    begin
                        if UploadIntoStream('Select a file to upload - Palletization Table', '', '', FileName, InStream) then begin
                            Rec."Palletization Table Att".CreateOutStream(OutStream);
                            BlobData := '';
                            repeat
                                InStream.ReadText(BlobData);
                            until InStream.EOS;
                            OutStream.WriteText(BlobData);
                            Rec."Palletization Table Att Name" := FileName;
                            Rec.Modify();
                            Message('File uploaded and saved successfully: %1', FileName);
                        end else begin
                            Message('File upload cancelled.');
                        end;
                    end;
                }
            }
 
actions
    {
        area(Processing)
        {
 action(PrintReport)
            {
                ApplicationArea = All;
                Caption = 'Print Report';
                trigger OnAction()
                var
                    ShipmentBrief: Record "Shipment_Brief";
                    ShipmentBriefRepot: Report "Shipment_Brief_Contact";
                begin
                    CLEAR(ShipmentBrief);
                    CLEAR(ShipmentBriefRepot);
                    
                    ShipmentBrief.SETRANGE("Invoice No Shipment", Rec."Invoice No");
                    ShipmentBrief.FindSet();
                    
                    if ShipmentBrief.FindSet() then begin
                        ShipmentBriefRepot.SETTABLEVIEW(ShipmentBrief);
                        ShipmentBriefRepot.RUNMODAL;
                      
                    end else begin
                        Message('No Sales Invoice Header found for No. %1', Rec."Invoice No");
                    end;

                end;
            }
*****************************************************************************************}
Third: I want to retrieve the image to appear in the report "Shipment_Brief_Contact"
 
report 50410 "Shipment_Brief_Contact"
{
    DefaultLayout = RDLC;
    RDLCLayout = './Report Layout/ShipmentBrief.RDL'; 
    EnableExternalImages = true;
    dataset
    {
        dataitem("Shipment_Brief"; "Shipment_Brief")
        {
            column(Palletization_Table; "Shipment_Brief"."Palletization Table")
            {
            }
            column(Palletization_Table_Att; "Shipment_Brief"."Palletization Table Att")
            {
            }
       }
}
 
This is all the code I have... I tried searching on Google but I didn't find a suitable solution close to what I want
 
 
Categories:
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 69,510 Super User 2024 Season 2 on at
    I Want a Way to Retrieve An Image From a Field In The Report
    Hi, hope the following can give you some hints.
    Dynamics 365 Business Central: How to add Media or MediaSet data type (Pictures) to a report
     
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans