cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TimDemma
Helper II
Helper II

Using/Comparing data of two Galleries

Hello PowerApps wizards,

 

Here is my dilema: I am trying to build a gallery (Gallery2) that will compare one of the data fields to a data field of another gallery (Gallery1) in order to use the OnClick function of Gallery 2 to make a phone call from a data field from Gallery1. Does that make sense?  So Gallery 2, will compare the name field to the name field in Gallery 1 (Line A), then once the match is found, it will pull the phone number and insert in Gallery 2 (Line B). Finally, the OnClick button (Circle C) in Gallery 2, will dial that phone number.

TimDemma_0-1622334289743.png

I've tried a couple versions of the LookUp formula (see below), but haven't been successful. Heeeeeelp!
LookUp(Gallery2.Selected.Title1,IsMatch(Gallery3.Selected.Body3),Gallery2.Selected.' Phone Number')

 

 

12 REPLIES 12
WarrenBelz
Super User
Super User

Hi @TimDemma ,

I am a bit confused where Gallery3 comes into this, but if you simply want to get the phone number from the List that forms Gallery1, where a field (you did not provide the name) in that list matches a field in the selected item in Gallery2, you would do something like this 

LookUp(
   Gallery1ListName,
   YourFieldName = Gallery2.Selected.FieldName
).'Phone Number'

 

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.

TimDemma
Helper II
Helper II

Hey Warren,

 

So I used your formula (thanks!) but the phone number the formula is pulling is from the first item of Gallery 2 and not the phone number matching the name found in Gallery 3 (the "My Rides" Gallery). I'd like to have Powerapps, find the same name from the "My Rides" gallery in Gallery 2 and then show the result as the phone number for that persons name. I hope I am making sense! I haven't finished my coffee yet 😛

 

TimDemma_1-1622370957984.png

 

Hi @TimDemma ,

Can we go back a step here - I am sure you know what you mean, but reading your first post description, there is no mention of gallery3 until the code bit.

Can you please set out exactly what you are trying to get from where - also use the list names that form the gallery as that is what you have to look up for your data.

TimDemma
Helper II
Helper II

Shoot! Sorry. So I should have written Gallery 3 instead of Gallery 1 in the original posting. 

I am trying to pull the phone number from Gallery 2 by using the Name that is in Gallery 3.

 

In context: Gallery 2 has both the names and phone numbers of employees (a directory) and Gallery 3 is a SP list that employees fill out. The 'OnClick' button of Gallery 3 will allow a phone call to be made to the Name that shows in Gallery 3 once the employee puts it in. 

Thanks @TimDemma ,

You still have to look up the list (not the gallery) - if the button is in Gallery3

LookUp(
   Gallery2ListName,
   YourFieldName = Self.Selected.FieldName
).'Phone Number'

 you simply look up the directory (list) where the field name is selected in Gallery2 and return the matching phone number from that record. Have I interpreted your needs correctly?

 

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.

TimDemma
Helper II
Helper II

Warren,

Sorry If we are going in circles or if I am not understanding what you are suggesting correctly. I tried to use the formula you put above and it still doesnt connect correctly. I copied the Gallery 2 onto the same page so I can visually see what items I am pulling into the formula and also added in just a regular text box to show if my formula pulls the right data rather than using the Gallery's OnClick button for now. Once I get the formula right, I will put that formula in the OnClick button. Here is where I am currently at: 

TimDemma_1-1622390986136.png

 

 

Thanks for your help.

Hi @TimDemma ,

You need to look up the list name with the data in it, so can you please provide the List name with the data you want, the field names of the phone number and the field you are wanting to match and also the "trigger" - you are selecting something from a gallery - what is its name and what are the Items of that gallery?

TimDemma
Helper II
Helper II

@WarrenBelz 

Ok, I replaced the "Gallery" entry's with the list names. This is what you meant, right? The error has gone from the red X to the yellow triangle, so we must be stepping in the right direction! 😄

TimDemma_1-1622459824974.png

This is what the alert says:

TimDemma_2-1622459914224.png

 

Thanks again for all your help and patience!

TimDemma
Helper II
Helper II

@WarrenBelz 

I also swapped the formula and get the same yellow triangle...

TimDemma_3-1622460209213.png

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,710)