
Announcements
Good morning.
I have a gallery with 4x text labels which I need to be colour coded depending on the value of a dropdown box (choice column SP list) in a form linked to the gallery.
The staff manager wants the gallery of staff colour coded depending on their dept, so,
If the person belongs to engineering, its needs to be cyan, if the person belongs to IT it needs to be yellow, HR, Green, Admin, orange, and a final option of NA, needs to be white or no colour.
I was looking at both If and Switch such as If(thisitem.department.value = "Engineering", Cyan) which works if the engineering option is selected from the dropdown but I need to add the other departments with their colours.
Many thanks
Switch makes the most sense here:
Switch(ThisItem.Department.Value,
"Engineering",Color.Cyan,
"IT",Color.Yellow,
"HR",Color.Green,
"Admin",Color.Orange,
Color.White)
Just FYI when using If, you can have multiple ifs like:
If(Condition, Result, Condition2, Result2....., ElseResult)But when all your conditions are based on 1 value, it's best to use Switch.