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!