I'm pretty new to Power apps so this is probably a pretty basic question to most people but I have been fumbling around with it for a few days.
I have two sharepoint lists: List 1 and List 2.
Both List 1 and List 2 have a text field named Map Location. Otherwise the two lists have different fields.
Map Location is unique. There will never be more than one entry in either list associated with a Map Location. List 2 will only have a single entry for a map location number from List 1.
What I need to do is put a combo box, needed as List 1 is somewhat large and search is necessary, on my power app that allows the selection of Map Location combo box from List 1 and puts the data and fields from List 2 into the edit form using the Map Location chosen in the combo box.
If there is no record for that Map Location in List 2 then a blank record should be brought up for edit with the fields in List 2.
This post https://powerusers.microsoft.com/t5/Building-Power-Apps/Lookup-with-2-sharepoint-list/m-p/706589#M22... was somewhat helpful but didn’t get me all the way there.
I can’t use a lookup field in the sharepoint lists as List 2 list is a temporary tracking list that once completed the row associated with the Map Location will be moved to a history list and deleted from List 2. I need the row in List 1 to remain when the row in List 2s is deleted.
Also List 1 gets deleted and rebuilt once per day. Long story but this is not going to change.
I can't figure out how to use two sharepoint lists with selecting Map Location from one list and bringing data and fields associated with the selected Map Location from a different sharepoint list in an edit form.
I’ve tried using collections and had no luck. I can’t seem to get the collection fields to show up in the edit form. I can get the collection to show up in available data. This seems like it might work I just don't have the knowledge to get it to work.
List 2 has12 fields so I had thought about adding the fields from List 2 to List 1 and using patch to fill in and/or delete the data as needed. This would probably work if List 1 didn’t get deleted and rebuilt each day.
Maybe it can’t be done and that is ok as well.
As you can tell I'm not a programmer in any way shape or form.
I’m open for any suggestions.
Thanks for any help anyone can provide!
Solved! Go to Solution.
For the field that you want to include data from List 2 based off the list 1 selection, you could use a Lookup.
LookUp( List2, MapLoc= ComboBox1.Selected.MapLoc, FieldYouWantToReturn)
Thank you for your help notj.
I had tried lookup and could not get it to work but with your help I got it to work.
You help is greatly appreciated!
So my next issue is I ran into was trying to evaluate if the Lookup is returning a blank.
If it is blank I need to start a new form.
If it is not blank I need to edit a form.
There are many examples of this and I thought it would be fairly simple.
Then I ran into this error: Expected a value compatible with DataSource.
The expression actually evaluates correctly but throws the error.
I'm guessing it's because combo data source is List 1 and the Form data source is List 2.
I found some posts about removing and adding the data sources. This didn't solve the issue.
I found a couple of other posts about starting the app over from scratch. This didn't solve the issue.
Any ideas to how to solve this or if it can be solved?
Hi @Kman ,
As per information you provided, why not set the Form's DefaultMode with If statement?
If(IsBlank(LookUp(List2,combo.selected.'Map Location' = MapLocation)),FormMode.New,FormMode.Edit)
Hope this helps.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Congratulations, the new Super User Season 2 for 2021 has started!
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.