On a task list, I want all 17 staff members of a team to have their own colour. I made a calculated column with this script found on the web, and it works fine for member 1 to 9. Unfortunately, member 10 to 17 is shown with the same colour as 1. Obviously because the script can't "see" the real numerical value of the figur.

Any suggestions to solve this problem would be appreciated :-)

=Navn&"<img src=""/_layouts/images/blank.gif"" onload=""{"&"var row=this;while(row.tagName!='TR'){row=row.parentNode}"&"row.style.backgroundColor='#"&CHOOSE(LEFT(RIGHT(Navn;2);1);"BFBFBF";"FFFF00";"8EAADB";"90B083";"A8D08D";"C9C9C9";"FFD966";"8496B0";"7030A0";"C00000";"92D050";"00B0F0";"FF0000";"00B050";"FFC000";"0070C0";"767171")&"'}"">"

enter image description here


This is pretty tricky undocumented usage of SP fields. That 1 as the second argument of LEFT function in CHOOSE(LEFT(RIGHT(Navn;2);1) might be the cause. It says to take 1 leftmost char of input string. Try to code your staff members like 01, ..., 09, 10, .. 17 and use ;2).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.