Hi,
I have a combo box that is based on a Share Point Choice field. The field called ColorsSelected displays the Share Point list combo box values display in ascending order as each choice is entered into the Share Point list:
Aqua
Blue
Green
Red
Violet
Yellow
If a user selects Red then Blue, the 2 items show as selected (Red, Blue) and that is how they are saved when I patch the data to back to Share Point.
I need to patch the selected combo box values in ascending order (Blue, Red). I know SortByColumns cannot be used with Choice fields so I used the Sort command. However it is not sorting the selected items back in ascending order:
ColorsSelected: Sort(comboboxColors.SelectedItems,"Ascending")
Does anyone know if this is possible? Thank you!!
Solved! Go to Solution.
Hi@luvagoldenk9,
Based on the issue that you mentioned, do you want to patch the sorted selected colors to the SP list?
Could you please tell me that if the Combo Box is allowed multi select?
I have a test on my side, please take a try as below:
Add a Button and set the OnSelect property as below:
Patch(
'YourSPList',
Defaults('YourSPList'),
{
'ColorsSelected ': Sort(
ComboBox4.SelectedItems,
Text(Value),
Ascending
)
}
)
Note: In my scenario, I add a Gallery to display the 'ColorsSelected' column on time once it is updated.
Regards,
Qi
Please consider changing your Formula to the following for the update to your Choice field in SharePoint:
ForAll(SortByColumns(comboboxColors.SelectedItems, "Value"),
{Value: Value,
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
}
)
This will sort the values and provide the proper information to update the SharePoint column.
I will be assuming that your Choice column allows for multiple selections.
I hope this is helpful for you.
Hi@luvagoldenk9,
Based on the issue that you mentioned, do you want to patch the sorted selected colors to the SP list?
Could you please tell me that if the Combo Box is allowed multi select?
I have a test on my side, please take a try as below:
Add a Button and set the OnSelect property as below:
Patch(
'YourSPList',
Defaults('YourSPList'),
{
'ColorsSelected ': Sort(
ComboBox4.SelectedItems,
Text(Value),
Ascending
)
}
)
Note: In my scenario, I add a Gallery to display the 'ColorsSelected' column on time once it is updated.
Regards,
Qi
Thank you for pointing the missing parameter. I needed to add the 'Text(Value)' to my Sort statement and it worked!
User | Count |
---|---|
254 | |
106 | |
92 | |
47 | |
37 |