Formatting Dataview Results Based on Values?

Things I have tried

Searched in the forums & online for a plethora of search terms.

What I’m trying to do

I am trying to determine if there is a way to add formatting on each row of a dataview table depending on one of the values in that row.

Specifically, I am trying to apply the strike-out formatting to each row where the State value is “Inactive.”

Current dataview query

I have a dataview table generated like this:

TABLE WITHOUT ID
Plant, Type, State
FROM #Food/Plant 
SORT Plant

What I have

Plant4 Type State
Basil Unknown Active
Berries Raspberries Inactive
Chives Unknown Active
Lettuce Buttersnap Active
Parsley Unknown Inactive

What I want

Plant4 Type State
Basil Unknown Active
Berries Raspberries Inactive
Chives Unknown Active
Lettuce Buttersnap Active
1 Like

I can suggest you something like this:

TABLE WITHOUT ID
	P1 as Plant,
	T1 as Type,
	S1 as State
FROM #Food/Plant 
FLATTEN choice(State = "Inactive", "<s>" + Plant + "</s>", Plant) as P1
FLATTEN choice(State = "Inactive", "<s>" + Type + "</s>", Type) as T1
FLATTEN choice(State = "Inactive", "<s>" + State + "</s>", State) as S1
SORT Plant

(you can replace <s> and </s> by ~~)

1 Like

Thank you, @mnvwvnm! That’s exactly what I needed.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.