web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using 'Lookup' to refe...
Power Apps
Answered

Using 'Lookup' to reference specific record in a collection

(0) ShareShare
ReportReport
Posted on by 232

Hi All,

 

I'm trying to devise a satisfactory way to display image thumbnails of attachments in separate image controls on a form (these image controls are not in a gallery and can't be in a gallery).

 

  • Quoting a direct url link from the Sharepoint site is unsatisfactory as it requires users to be logged into Sharepoint specifically otherwise the thumbnail appears blank.
  • Using the 'First(LastN' formula is also unsatisfactory as it will display duplicates of the last attachment of an item in all unused image controls (Users have the ability to load up to 10 images, but sometimes will only load 1 for a given form).

So...I'm trying to create a collection of all attachment 'values' and 'display names' in a given item (up to 10) using the ClearCollect function when users open the form from the main gallery screen so that I can use the 'Lookup' function in each respective image control (1 through to 10).

 

But I can't get the collection to work correctly.

 

If I use this formula:

ClearCollect(StoryImages, {ImgName: ThisItem.Attachments.DisplayName, ImgData: ThisItem.Attachments.Value});

I get two nested tables (with correct data inside them), which seemingly confuses the Lookup function.

Example Image:

Image Collection Incorrect.jpg

 

If I use this formula:

ClearCollect(StoryImages, ThisItem.Attachments.DisplayName, ThisItem.Attachments.Value);

I get a table with the display names listed correctly, but the Value data is missing.

Example Image:

ImageName Collection Incorrect.jpg

 

If I use this formula:

ClearCollect(StoryImages, ThisItem.Attachments.Value);

 

I get all the image values in a nice table, but of course no image name to use as a 'key' for the Lookup function.

Example Image:

ImageValue Collection Data.jpg

 

What I need is this Photoshop representation of the table:

 

The Holy GrailThe Holy Grail

 

If I can achieve this, it's my understanding that I could use the following Lookup formula to reference the specific image value for a specific image control assuming I've named each collection column 'ImgName' and 'ImgData'):

 

LookUp(StoryImages, ImgName = "Image001.jpg").ImgData

 This formula is derived from this article for reference:

http://powerappsguide.com/blog/post/data---how-to-access-nested-collectionstables

 

I've been battling this particular issue for months now, and as you might be able to tell I've tried just about every solution out there to no avail. If anyone is able to guide me in the right direction with respect to this collection problem I'll be very grateful.

 

Thanks in advance,

 

Chris.

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    Hi @cfebvre ,

    So I understand the scope - are you wanting to display the images from items in a gallery (Gallery1) in another gallery and/or on separate image control on the screen. The following would be from the selected item in Gallery1

    ClearCollect(StoryImages, ThisItem.Attachments)

    The Image control Image property in the StoryImages gallery (Gallery2) is

    ThisItem.Value

    Gallery2 does not need to be a collection - the Items can be

    Gallery1.Selected.Attachments

    An Image control outside Gallery2 showing the item selected in it would be

    Gallery2.Selected.Value

    Am I on the right track here?

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • cfebvre Profile Picture
    232 on at

    @WarrenBelz Hi Warren,

     

    Thank you! I've finally worked it out - I was overly complicating the ClearCollect Function.

    As in your example all I needed to write was:

    ClearCollect(StoryImages, ThisItem.Attachments)

    This collects a table of the Aboslute Uri, the Id, the DisplayName and the Value of the Attachments.

     

    From there I could use the Lookup Formula to find the specific attachment in the collection by using the DisplayName column.

    Final Solution.jpg

     

     

  • WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    Thats great @cfebvre ,

    Also I have added a line to my post - you actually don't even need a collection.

  • cfebvre Profile Picture
    232 on at

    @WarrenBelz Oh thank sounds even better. I will tinker with it tonight and let you know how I go. Thanks again, and when I get the chance I'll mention this thread in my previous post as well.

     

    Cheers,

     

    Chris.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard