cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
matteoseni
Frequent Visitor

Matching IDs in two lists - code syntax problem

Goodmorning everyone,

first of all I would like to explain my problem, taking into account the fact that I am a beginner with databases and this platform:

I'll start by explaining which are the lists in Sharepoint that are used as a database for the App in PowerApps.

  • there is a "Customers database" list containing all the names of the customers, with their main information.
  • there is a "Key Contacts" list in which all the contacts relating to a specific customer are present
  • and so on...

 

the main problem is that by creating the lists, each Costumers (in the Costumers database) will have an ID, and within the Key Contacts, each Contact will have another ID ...

however a customer can have multiple contacts, so I thought of putting a secondary ID in the Key Contacts list, the problem is that it should be updated manually every time, making the costumer ID (Costumers Database) equal to the new secondary ID in the Key Contact, but doing so would be inconvenient ... I wanted to ask you: is there an automatic way to correlate the IDs in the two lists?

 

Trying to work around this problem, I thought of inserting a formula, in which I match not the IDs, but the names… to bypass the problem, but it gives me this error (maybe I have wrong the syntax):

 

codice.PNG

 

App screen:

 

schermata app.PNG

 

List in SharePoint:

 

sharepoint, companyname.png

 

I wanted to ask you for a hand in this regard, both for the first case, and (possibly if not possible), for the second.

Thank you!

 

Matteo.

 

9 REPLIES 9
JR-BejeweledOne
Super User
Super User

Try this instead,

 

Filter('Key Contacts'; Company_x0020_name in GalleryCustomer.Selected.'{Name}')



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Thank a lot for the reply! But unfortunately it doesn't work.. as below:

 

matteoseni_0-1616417607757.png

 

And the field name in the Customers Screen (app screen referenced by the selected item), is correct, as below: ( {Name} )

 

matteoseni_1-1616417818313.png

 

Thank you very much if you can help me!

 

JR-BejeweledOne
Super User
Super User

Where is Company_x0020_name coming from?  Is it a field that someone has selected or something else?

 

Also can you translate your error for me?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Company_x0020_name is the field name of the "Key Contacts" list in SharePoint.

and this field is the same as the name shown in "{Name}" in the screenshot I attached above (Gallery Costumer).

Precisely I would like that when the {Name} selected in the Costumer Gallery, is found in the "Company Name" column in Key Contacts, it gives me back the Company_x0020_name, that is the Company Name.

(it is only an explanatory example, to project a result, taking into account the same name).

 

the error simply says that the formula contains an error, and to examine the formula and run it again.

 

Thank you!

JR-BejeweledOne
Super User
Super User

Instead of this:

 

Filter('Key Contacts'; Company_x0020_name in GalleryCustomer.Selected.'{Name}')

 

Can you try this:

 

Filter('Key Contacts'; Company_x0020_name in GalleryCustomer.Selected.Name)



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
matteoseni
Frequent Visitor

matteoseni_0-1616420376567.png

 

"the name is invalid. unrecognized identifier".

I think he expects an ID, but unfortunately as I anticipated, it is not possible for me to equate them between the lists

 

JR-BejeweledOne
Super User
Super User

Ok, I have never seen that require {} around the identifier.

 

If you remove the Name at the end of the formula, do you get a dropdown with selections?   Is Name one of the selections?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
matteoseni
Frequent Visitor

Yes:

matteoseni_0-1616421052206.png

 

Or, would there be a different way to do what I need? exactly display all the lines of the Key Contacts list, whose "Company Name" field is the same as the one selected in the Costumers Screen?

 

Thank you

 

 

 

JR-BejeweledOne
Super User
Super User

Please excuse all the questions, different language versions of Power Apps work a little differently.

 

Can you try Filter('Key Contacts'; 'Company Name' in GalleryCustomer.Selected.'{Name}')



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,601)