Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Displaying Item Image in a Custom List Page

(1) ShareShare
ReportReport
Posted on by 639
BC SaaS v24.5 here. I have added a Tenant Media variable to my custom list page (ItemImage). And this variable's Content has been added a field to my custom list page (ItemImage.Content). My question is when it comes to iterating the records and displaying the item images, not all items have images defined. So I want to handle that, and not have the list page field referencing the last match for some other item. My code handling this is below. My thinking is the Init() method will handle this okay. Any downsides? I'm not inserting a blank record in the Tenant Media recordset. Just essentially creating a blank for that iteration.
 
if Item.Picture.Count > 0 then begin
                ItemImage.Get(Item.Picture.Item(1));
                ItemImage.CalcFields(Content);
end else
                ItemImage.Init();
 
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,218 Super User 2024 Season 2 on at
    Displaying Item Image in a Custom List Page
    Why is it so complicated? The Picture field in the item table is empty if no picture is set, so just add this filter before the loop.
     
    Hope this helps.
    Thanks.
    ZHU
  • Greg Kujawa Profile Picture
    Greg Kujawa 639 on at
    Displaying Item Image in a Custom List Page
    Thanks, but my method of displaying these item images is working. That's not the question. The question is if using the Init() method for creating essentially a blank/missing item image is going to add a lot of overhead or bloat anything. Some of these list pages will have 10-20K rows. Currently the list pages don't seem to be too sluggish to render and navigate. But nevertheless was concerned about adding all of the Init() loops for those rows without item images available.
     
    What I'm doing is using a temporary Item Ledger Entry table. Querying the real Item Ledger Entry table, cross referencing other tables such as the Item table, and adding records to my temporary table. After I get each record for my list page I am pulling the item image associated with each ILE line. If a particular item doesn't have an image I need to account for that. Otherwise that page variable is just repeating the last item image that was available.   
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    Khushbu Rajvi. 5,496 on at

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,575 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans