Forum Discussion
Sharepoint list format whole row using indexOf
- Jan 02, 2022
I haven't tested, but you should be able to replace the entire operator object that starts with opening brace on line 3 and ends on line 16 with the if statement on line 6 in first example. Then replace @currentfield with [$Training_x0020_Crs_x0020_Ttl]
The result will be the following:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "additionalRowClass": "=if(indexOf([$Training_x0020_Crs_x0020_Ttl],'oliday') != -1, 'sp-css-backgroundColor-BgCornflowerBlue sp-field-fontSizeSmall sp-css-color-CornflowerBlueFont','')" }
I hope this helps.
Don
Please click Mark as Best Response & Like if my post helped you to answer or resolve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
I haven't tested, but you should be able to replace the entire operator object that starts with opening brace on line 3 and ends on line 16 with the if statement on line 6 in first example. Then replace @currentfield with [$Training_x0020_Crs_x0020_Ttl]
The result will be the following:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalRowClass": "=if(indexOf([$Training_x0020_Crs_x0020_Ttl],'oliday') != -1, 'sp-css-backgroundColor-BgCornflowerBlue sp-field-fontSizeSmall sp-css-color-CornflowerBlueFont','')"
}
I hope this helps.
Don
Please click Mark as Best Response & Like if my post helped you to answer or resolve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Chris_BoylanJan 10, 2022Copper Contributor
@Don Kirkham, thank you! it worked. To help me understand, do you know the reason there are two possible approaches to the logic? (the 'if' and the 'operator' examples in my opening post). Is it just the flexibility of the code and then the skill of the coder to get a more succinct expression?
- Don KirkhamJan 10, 2022MVPI don't know the reason behind the two options. While Microsoft uses the operator syntax when it takes the list options in the UI and converts them into the Advanced view, having the "if" option is great for people that have been working in Excel for years as the formulas are very similar to what is offered in Excel.
Glad I could help!