Hello all!
I have a main SharePoint list, 'ConferenceRooms', that holds every room inside of our office's campus. Each row (item) in this list is a room.
--------------------------------------------------------------------------------------------------
In another SharePoint list, we have a list called 'Maps' that has 2 columns:
1) Title - the name of the map attachment
2) Attachments - the actual PNG attachment corresponding to the name of the file
--------------------------------------------------------------------------------------------------
What I am trying to do is:
We have 1000+ rooms in our campus, and it wouldn't make sense to manually upload 1000+ attachments in each room (under a new column) in our 'ConferenceRooms' list ... so we built the "Maps" column in our 'Conference Rooms' list to mirror items that have the same value in "Title" column of our 'Maps' list.
What we want to do is: IF the item selected in the "Maps" (choice-type) column of our 'ConferenceRooms' list has the same name as an item in the "Title" column of the 'Maps' list ... we want to pull the corresponding attachment from that item in the "Attachments" column of our 'Maps' list into our PowerApp.
What code/logic would help us achieve this? I've tried numerous ways so far but no luck. Thank you!
Solved! Go to Solution.
Sure thing...then you just need to reference that in your LookUp.
So, first, if you only have one attachment for the photo, then you can set the Image property to:
First(LookUp(Maps, Title = yourCurrentRecord.Map.Value).Attachments).Value
In the event that there is NO corresponding record in your Maps list, you might want to consider a "sample/default" image. You can add that image in your media of the app and then you can set the Image property to:
Coalesce(
First(LookUp(Maps, Title = yourCurrentRecord.Map.Value).Attachments).Value,
yourSampleDefaultImage
)
If the lookup returns an image...that will be what is shown. If not, then your "fill-in" image will be shown.
LookUp(Maps, Title = yourChoiceControl.Selected.Value).Attachements will give you the attachments of the item in your list.
Not sure how you want to use it from that point, but that will do what you need.
I hope this is helpful for you.
Thank you for your response. We don't have a choice control within our PowerApp, but rather the choice is selected within our SharePoint list and is fixed once completed. Essentially, what we want to do is to pull up the attachment (which is a photo) into the Detail Form of each room in our PowerApp ... similar to the "Room Photo" section that you see in the following screenshot:
Sure thing...then you just need to reference that in your LookUp.
So, first, if you only have one attachment for the photo, then you can set the Image property to:
First(LookUp(Maps, Title = yourCurrentRecord.Map.Value).Attachments).Value
In the event that there is NO corresponding record in your Maps list, you might want to consider a "sample/default" image. You can add that image in your media of the app and then you can set the Image property to:
Coalesce(
First(LookUp(Maps, Title = yourCurrentRecord.Map.Value).Attachments).Value,
yourSampleDefaultImage
)
If the lookup returns an image...that will be what is shown. If not, then your "fill-in" image will be shown.
This is extremely helpful, I do have one last question though. What would go in place of "yourCurrentRecord" ? Would it be the item (room) that is selected from the Gallery to pull its details up? I'm guessing maybe a "thisitem" ?
First(LookUp(Maps, Title = yourCurrentRecord.Map.Value).Attachments).Value
@jharville
Well that depends! You showed an image with the top part showing details about the Conference room. How are you displaying that information? For example, there is a label that shows the DisplayName...what is the text property of that control?
I got it! Used my 'varThisItemGal' variable that was created earlier and it worked like a charm. Thanks again for your help Randy, you're the man!
That was what I was looking for 😁
Glad you found what you needed!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
184 | |
53 | |
41 | |
36 | |
30 |
User | Count |
---|---|
240 | |
74 | |
71 | |
69 | |
65 |