Several dropdowns (not on a form nor gallery).
The user is to select from a list from most important to least important.
The second dropdown contains all the items in the first list except the one selected.
The third dropdown contains all the items in the first list except the ones selected in dropdowns one and two, etc.
Each dropdown is not visible until the one before it is selected.
The user may rank the list as far down as they want. For example, they can select from dropdowns one, two and three and then save to a Sharepoint list.
The issue is with the Patch. It is saving all the fields but if the user stops on item 3, item 4 saves the value default value "Select ..." which pops up after item four is selected but fields 5 to the end of the save same other values in the list not selected and not the default.
For some reason, the dropdowns after item 4 are showing each successive value as the next item on the list not shown in one of the preceding dropdowns.
At this point I don't even have a way to check the control and put a correct value in a variable for the patch.
Any insight would be appreciated.
Thank you for your reply.
When patching the selected values from multiple dropdowns, make sure you only include the values that the user has selected and avoid patching default or unselected values. Here’s how you can achieve that
1. Ensure you store the selected values of each dropdown in a variable when the user makes a selectio, for example:
Set(varDropdown1, Dropdown1.Selected.Value);
Set(varDropdown2, Dropdown2.Selected.Value);
Set(varDropdown3, Dropdown3.Selected.Value);
Set(varDropdown4, Dropdown4.Selected.Value);
Patch
2. Construct the patch function to include only the selected values by checking if the variables are not blank before including them in the patch:
Patch(
'SharePointListName',
Defaults('SharePointListName'),
{
Column1: varDropdown1,
Column2: If(!IsBlank(varDropdown2), varDropdown2, Blank()),
Column3: If(!IsBlank(varDropdown3), varDropdown3, Blank()),
Column4: If(!IsBlank(varDropdown4), varDropdown4, Blank())
// Add additional fields as necessary
}
);
If my response resolved your issue, please feel free to mark it as the solution by clicking accept it as a solution.
If you liked my solution, please give it a thumbs up.
This helps others find the answer more easily.
Connect with me: LinkedIn
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional