web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps ComboBox: It...
Power Apps
Suggested Answer

PowerApps ComboBox: Items from one Sharepoint List, Save to Another w/ Lookup Field

(0) ShareShare
ReportReport
Posted on by 2
Hello -
 
I'm not sure how best to explain this, but I'm working on a Canvas app as a Proof Of Concept to allow someone to enter in a date and one of 76k different industry standard codes.  I want to use a ComboBox so that the user can manually type in the value but it can also show possible values as they type.  I already have two Sharepoint Lists set up, one with all of the codes loaded (called "wv", indexing added for all columns) and one to store the values that the user enters through the app (called "pa", indexing added for all columns as well).
 
My first attempt at this was to use a date field and a regular text field in pa, and after some struggle, I was able to get it set up the way I want it to work.  My items for the ComboBox uses the following function: 
 
Filter(wv, StartsWith(icd, Self.SearchText) && dpDOS.SelectedDate >= rec_eff_dt && dpDOS.SelectedDate <= rec_cncl_dt)
 
I followed a tutorial that showed me how to track changes using an invisible button with the following onSelect function:
 
If(IsBlank(LookUp(rowUpdates,ID=ThisItem.ID)),Collect(rowUpdates,ThisItem));UpdateIf(rowUpdates,ID=ThisItem.ID,{dos:dpDOS.SelectedDate,icd:cbDx.Selected.icd})
 
And then it is saved with a Save button with the following onSelect function:
 
Patch(pa, ShowColumns(rowUpdates, ID, dos, icd));
Notify("Changes saved.", NotificationType.Success, 5000);
Set(varReset, false);
Set(varReset, true);
 
This is all working properly!
 
 
Now that that more simple solution was functional, I changed that text field to a Lookup field, as I want to store the relation to the other List like a regular database instead of just the value.  This is where things stopped working.
 
The ComboBox items seems to have Delegation issues when I try to point directly to pa:
Filter(pa, StartsWith(icd.Value, Self.SearchText))
Despite everything I'm reading online, the StartsWith portion of the above is underlined in brown and it's indicating a Delegation warning.  I couldn't figure out how to access the rec_eff_dt & rec_cncl_dt from wv this way, either, which is necessary.
 
So, I went back to using the same function as before, pointing to wv and not pa.  This at least removes the error/warning, BUT the choice list never populates with any of the possible values while I type, either.
 
That being said, I can't seem to get the function for the invisible button to work at all.  No matter what I think of doing, I can't get it to accept the updated record, specifically the icd Value.  The only error I keep getting is "Invalid argument type.  Expecting a record, but of a different schema."  I tried using a cbDx.Selected directly, sub-record using ID & Value, I tried a sub-record that mirrors all the columns from wv, and I keep getting that error.
 
How can I figure out what schema it wants?
 
How can I get the choice list to populate with possible values like I was able to before?
 
Is there a different way that I can get this to work with a Lookup field despite the delegation?
 
Any help anyone can provide would be greatly appreciated.
 
Thanks!
Categories:
  • NickWarner Profile Picture
    113 on at
    Can you post a screenshot of the what the screen looks like? how is the date and the code related? could you do two steps with a date selection first then filter the codes based on the date selected?
  • Suggested answer
    JH-09011713-0 Profile Picture
    2 on at
    Hi, Nick!  Thanks for responding.
     
    Sorry, new to the platform and I didn't realize I could post images.  The screen is super simple at this point.  It looked like this:

     
    I say looked, because I somehow stumbled upon the solution as I was trying to take screenshots of everything.  Trying to go through pa_sp_test_2 kept yielding a delegation error on StartsWith, even though StartsWith is supposed to be delegable for complex fields, so I'm not sure why that's happening.
     
    When I changed the Items of the ComboBox to work directly the wv_icd_diag list, I was having issues trying to figure out how to save that value to a Collection for purposes of saving it into pa_sp_test_2 when the Save button was clicked because it kept looking for a different schema, but I couldn't figure out what the schema was.

    Although I was trying ID & Value, I kept getting the same error, but I think it's because the value I was using was ultimately not correct.  What I ended up working for me was:
     
    UpdateIf(rowUpdates,ID=ThisItem.ID,{dos:dpDOS.SelectedDate,icd_diag_cd: {Id: cbDx.Selected.ID, Value: cbDx.Selected.icd_diag_cd} });
     
    Once I had that figured out, everything else fell into place.
     
    So, thank you for making me go through the process of getting screen shots and helping me answer the question!
     
    Really appreciated!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard