Table View (formating cell values if condition)

Hi friends

It’s possible to color a cell value if a condition is met (like excel, PBI…) using table view?

Case

I’m using table view and i wnat to color a value if is greater than zero

image

It’s possible? I didn’t find anything in the forum.

Hello @Felipereis50 ,

You can use Java snippets and Table view (javascript) nodes.

write code in Java snippets nodes like

“String color = c_Value > 0 ? “green”: “red”;
out_Value = “<font color="” + color + “">” + c_Value + “”;”

workflow:

Screenshot 2024-01-29 151106

Output:

1 Like

Hi friend,
I see… :fist_right: :sparkles: :fist_left:

Using Table View it is not possible, right?

Hey,

this is now super easily possible without code and with the new table view node.
You can now color cells with the expression node → check the attached workflow for an example. (you need to have the new reporting extension installed)

Reach out if you have questions.

Greetings,
Daniel

TableViewFormatting.knwf (72.3 KB)

2 Likes

Hi Daniel

Thanks for the code.

I see that is possible. I will keep your code with me :grinning:

if(column(“Universe_0_0”) > 0.5) {htmlColor(column(“Universe_0_0”), “red”)} else htmlColor(column(“Universe_0_0”), “green” )

:fist_right: :sparkles: :fist_left:

3 Likes

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