In my Sharepoint list ("OriginalSharepointList") I have a column with a combobox with the option to type an entry. You can select multiple already existing options or you can enter your own option (which will be an additional option from now on).
I would like to have the same functionality in my Power App. Unfortunately, when I use forms and Data Cards I can only choose between the options and also select multiple values. But the user can't add an entry.
I tried two things, both didn't work:
1) I activated the option in the Power Apps Combobox to be able to search for text. If the user wouldn't choose an already existing option the Data Card would update the entered search text. The problem with this approach is that the user can't choose already existing options AND add his/her own option. I got this solution from this thread: Combo Box Text Entry - Power Platform Community (microsoft.com)
2) My own approach was without Forms. I instead added a Textfield (TextInput_Add_Option) where the user can enter the new option. This would then get patched to its own Sharepoint list (DropdownSelection_SharepointList) where all the already existing options are being stored. With this Textfield the user can add as many option as he/she wants to.
Patch('DropdownSelection_SharepointList';Defaults('DropdownSelection_SharepointList');{Title:1; DataQuality: 'TextInput_Add_Option'.Text});;
The data source for the options of the Combobox (ComboBox_DataQuality) is this new Sharepoint list (DropdownSelection_SharepointList). This worked perfectly. The user is able to choose multiple options in the Combobox. Unfortunately, if I want to patch the selected options in the Combobox to the Sharepoint list (OriginalSharepointList) I get an error saying " a table entry with a different scheme was expected".
Patch(OriginalSharepointList;First( Filter( OriginalSharepointList; ItemID = SelectedGallery.ItemID));{DataQuality: ComboBox_DataQuality.SelectedItems})
What would be a solution for my problem?
Solved! Go to Solution.
Ok I figured it out. I sticked to option 2.
The Combobox (ComboBox_DataQuality) doesn't get its option-data from the main list (OriginalSharePointList). I created a second list (DropdownSelection_SharepointList) with a column called DataQuality. The entries of this column are all the options that already existed in the original list.
Next to the ComboBox I added a button. If the user clicks on it a TextInput gets displayed. The user can add another option simply by typing it into the TextInput. This gets patched into DropdownSelection_SharepointList.
The ComboBox gets its data from this DropdownSelection_SharepointList and displays now - next to the old entries - the new entry of the user. The user is now able to select as many option as he/she wants to and also add new entries.
If we want to patch the selection of the ComboBox:
Clear(colDataQualityToPatch);;
ForAll(ComboBox_DataQuality.SelectedItems;Collect(colDataQualityToPatch;{Id:ThisRecord.ID;Value:ThisRecord.DataQuality}));;
Patch(OriginalSharepointList; First( Filter( OriginalSharepointList; Item_ID= SelectedGallery.Item_ID)); {DataQuality:colDataQualityToPatch});;
If you want an explanation of the code, here's the video which explains it perfectly:
Ok I figured it out. I sticked to option 2.
The Combobox (ComboBox_DataQuality) doesn't get its option-data from the main list (OriginalSharePointList). I created a second list (DropdownSelection_SharepointList) with a column called DataQuality. The entries of this column are all the options that already existed in the original list.
Next to the ComboBox I added a button. If the user clicks on it a TextInput gets displayed. The user can add another option simply by typing it into the TextInput. This gets patched into DropdownSelection_SharepointList.
The ComboBox gets its data from this DropdownSelection_SharepointList and displays now - next to the old entries - the new entry of the user. The user is now able to select as many option as he/she wants to and also add new entries.
If we want to patch the selection of the ComboBox:
Clear(colDataQualityToPatch);;
ForAll(ComboBox_DataQuality.SelectedItems;Collect(colDataQualityToPatch;{Id:ThisRecord.ID;Value:ThisRecord.DataQuality}));;
Patch(OriginalSharepointList; First( Filter( OriginalSharepointList; Item_ID= SelectedGallery.Item_ID)); {DataQuality:colDataQualityToPatch});;
If you want an explanation of the code, here's the video which explains it perfectly:
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
207 | |
98 | |
60 | |
55 | |
52 |
User | Count |
---|---|
257 | |
161 | |
87 | |
79 | |
68 |