One of our SharePoint chefs at the office was came up against a brick wall earlier to today when trying to apply some conditional formatting to rows in a SharePoint list. He was trying to colour code rows depending on the value in the 'location' column in any row. Simple, everyday stuff.
After looking at the field he was referencing when writing the condition criteria, yours truly noticed that the field in question was in fact a lookup field referencing another list.
This means that while the condition was set to look for a value of 'x', SharePoint was also getting back the numerical values that made up the ID of the lookup item in the master list when querying that field.
You'd expect that changing the comparison part of the clause to 'contains' instead of 'equals' would sort that out. And quite frankly I looked like a right dick when I told everyone it would, and then in fact it didn't.
The solution that did work was:
- In SharePoint: Create another column, with a 'single line of text' field.
- In SharePoint Designer: Create a workflow to copy the the text from the lookup column to the new column when a new entry is created.
- In SharePoint Designer, open the list and the view you want to apply the formatting to, and ammend your existing conditional formatting entry to reference the newly created column.
- Hide either one of the duplicate columns fron the view you're working on.
No comments:
Post a Comment