cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Lookup within Gallery not working correctly

Hi all,

 

I've seen the powerapp platform behave so inconsistently when using the Gallery that it makes me wonder what is a safer alternative. My latest and simplest to explain issue is as follows:

 

Place a gallery based on a datasource (cached view of SQL DB)

Place an Image within the gallery, with the Image property having the value:

 

LookUp(dimResidentPhoto, PhotoFileID = ThisItem.PhotoFileID).Photo

 

And voila, it doesn't look up correctly. On very first load it will actually load fine, but as soon as you refresh/filter the lookups are off. I have confirmed and write out the PhotoFileID alongside the image and they are definitely unique, and there is definitely a different photo for each ID. The filters/data is definitely working fine, only the lookup/image is causing problems.

 

So even though the ID is different, it always grabs/shows the first photo for ALL gallery elements. Obviously this is a bug, but what are my alternatives?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Anonymous 

An alternative is to do this in the Items property of the gallery.

Ex:

AddColumns(
    yourDataSource As _source,
    "_photo", LookUp(dimResidentPhoto, PhotoFileID = _source.PhotoFileID).Photo
)

Then set the Image property to ThisItem._photo

 

This will perform the lookup as part of the table for the Gallery rather than having each line in the gallery then do its lookup - as this occurs after the rendering of the gallery.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@Anonymous 

An alternative is to do this in the Items property of the gallery.

Ex:

AddColumns(
    yourDataSource As _source,
    "_photo", LookUp(dimResidentPhoto, PhotoFileID = _source.PhotoFileID).Photo
)

Then set the Image property to ThisItem._photo

 

This will perform the lookup as part of the table for the Gallery rather than having each line in the gallery then do its lookup - as this occurs after the rendering of the gallery.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Thanks Randy, I have noticed that using a cached view (rather than a DB lookup) also solves the problem.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,837)