Forum Discussion
Peggy Lang
Jul 19, 2022Brass Contributor
List with dropdown choice and multiple selections allowed
I have a sharepoint list with 6 columns. Each column is a dropdown choice of months of the year and multiple selections are allowed. I would like to create a view that will show me all items that h...
grant_jenkins
Jul 24, 2022Steel Contributor
I haven't quite managed to hide the rows with less than 4 values across the choice fields, but did manage to highlight the rows that contained at least 4 values in any of the choice fields. Hopefully this will help a bit with the logic. It's using the length function to return the total number of items in the choice fields as they are stored as an array of values.
I'm not actually sure if you can hide a row without overriding all the fields in the list. I was hoping there was an ms class for hiding a row, but didn't find anything.
See example JSON that uses 3 choice fields (Choice1, Choice2 and Choice3) all of which contain the months of the year (January, February, March, etc.).
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalRowClass": {
"operator": ":",
"operands": [
{
"operator": "||",
"operands": [
{
"operator": "||",
"operands": [
{
"operator": ">=",
"operands": [
{
"operator": "length",
"operands": [
"[$Choice1]"
]
},
4
]
},
{
"operator": ">=",
"operands": [
{
"operator": "length",
"operands": [
"[$Choice2]"
]
},
4
]
}
]
},
{
"operator": ">=",
"operands": [
{
"operator": "length",
"operands": [
"[$Choice3]"
]
},
4
]
}
]
},
"sp-css-backgroundColor-BgCornflowerBlue sp-field-fontSizeSmall sp-css-color-CornflowerBlueFont",
""
]
}
}
An example of what it looks like below.