cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rlmckean
Helper IV
Helper IV

Problem matching two sets of lists !

Hi

Slowly getting an app together - however brain has stopped on this one.

All references are from sharepoint lists - I do not use lookups as imported from Azure.

I have a list that holds lookup IDs for Quotations, Clients and Contacts.The list is called People ( don't ask !)

I have a screen that shows all contacts connected to a single client connected to a single quotation. - a collection CContacts

Each contact has a client ID in its record as no contacts work for more than one client.

I want to display a gallery with all contacts that are connected to a client but who are not connected to a quotation.

So I can get a list of Contactids for the client, ID1,ID4,ID6,ID8 call it clientcontact

I can get a list of all contactids in the People list with matching quotation ID and Client ID. say ContactID 1,ID6 - from the CContacts collection

How do I get a collection that will hold contacts IDs 4 and 8. 

I can get the in function to work on one clientcontactID in CContacts (Contact column) but I can't see how to run a for all on   as it says in the help that this will not run on a collection

All ideas gratefully received

 

Cheers

 

Richard

 

 

 

6 REPLIES 6
v-yamao-msft
Community Support
Community Support

Hi rlmckean,

 

I am not clearly with your scenario.

 

Could you give me more clarification?

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Mabel -

Just going out - will rfeply later thanks

Richard

 

Hi again Mabel

so its like this.
I have a quotation list that gets filtered into a collection 'quotes' for all quotations for an enquiry -
(we quote to different clients for the same enquiry). The 'quote' s collection holds the enquiry ID (quoteno), same for all rows in the collection, and clientid , different for each row in the collection.
Each client has contacts attached to it by utilising a field in the Contacts list in a column which holds the clientid.
Not all client's contacts are attached to each quotation so there is a 'matching' list 'People' . Each row in People holds a quoteno, clientid,contactid.
The schema is like this
Enquiry     Quotes     Clients     Contacts       People
Quoteno   Quoteno    Clientid      ContactID      Quoteno
                 Clientid                       Clientid          Clientid
                                                                          ContactID

 

When a user wants to attach the first contact to the Enquiry, A collection CContacts filters the Contact list by Clientid , the clientid coming from the Quotes list. When a contact is selected from the gallery , a record is patched to People with relevqant three IDs 

 

When a user wants to view the contacts attached to a quotation, list 'People' is filtered by ( quoteno and clientid) into a collection Qcontacts . This loads a gallery with the attached contactids and data .

 

The problem I have then is when a user wants to link a second contact, I have to have a further collection that will filter only those contact IDs from the CContact collection that are NOT contained within the collection Qcontacts. ie Client contacts that exist but that are not allocated to the quote.

This is where I hit a wall in in understanding the Forall etc. In Access, I would run a for each..endfor or a do while endo construct. I have messed around with the countrow function etc but not got anywhere

I am sure you will have an easy solution I have missed - have a good weekend

Cheers

Richard

Hi MAbel

I have narrowed this down now to this. 

If I set Items in a gallery to this

Filter(CContact,COID in Cpeople.Contact)

I list the contacts in the contact list that are listed in the People collection

What i need is this 

Filter(CContact,COID NOT in Cpeople.Contact)

which lists the contacts exisiting for a client that are not in the people collection - and it does not like it !!!

Is there a way around this ??

 

Cheers

 

Richard

Me again Mabel

Worked it out down the washing up !

Filter(CContact,!(COID  in Cpeople.Contact)) works just fine !

Apologies foir taking up your time reading all this - but writing it down concentrates the old mind and hence - sometimes- solved the problem itself !!

 

Cheers

 

Richard

 

Hi rlmckean, I am so glad to hear that you have figured out a solution for this issue. Anytime you got issues when working with Powerapps, please feel free post your issues here, we are always ready to help. Best regatds, Mabel Mao
Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

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.

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 (2,657)