Change the color of Number text(field) depending from the value
Hello Everyone
I want to change the color of the text (field) of my Number field depending of the added value.
For example:
I have two number fields - Number and Number1
I am using that in the Trigger after update
let AA := 'Number 1';
styled(text(AA), if AA < Number then "red" else "green" end)
but the color is not changing.
The idea is, that I have to be able to write in Number1 and the color to change automatically after adding the value.
It that possible at all?
20 replies
-
If you are in form view then there is no way to change the text color, even manually, in a number field.
If you are in table view then you can add a conditional format rule to the column for Number 1.
One solution is to add a formula field that can change colors.
-
I'm not entirely sure, but it might be possible with a bit of hacking, as demonstrated in the post below:
-
You have give me a good idea! Thank you!
It's there a way to change only the color of the text, because now I am changing the color of the fieldif Number > 'Number1' then
styled(text("Text"), "red")
else
styled(text("Text"), "white")
end -
Thank you every one!
I have made it!
But now I have another problem.
I am using a formula to make it happend.Some of the text are bigger than the length of the window for the text.
When this is a normal text I can make it on several roads.
But - no matter what I am trying - in the formula window it's always on one line.
Some ideas?
-
Wow - thank you for your answer, but I am not so good with Ninox.
For me even that was quite of success
let c := Number - 'Number 2';
if c > 0 and c <= 5 then
styled(text("Text"), "", "green", "")
else
if c > 5 and c <= 8 then
styled(text("Text"), "", "magenta", "")
else
if c > 8 and c < Number then
styled(text("Text"), "", "red", "")
else
if c < 0 then
styled(text("Text"), "", "yellow", "")
else
styled(text("Text"), "", "black", "")
end
end
end
end -
I've been thinking bout abstracting this situation and have come up with
let a := ["red", "orange", "green", "blue"]; let b := [0, 5, 10]; let j := 0; for i in b do j := j + number(Number > i) end; styled("Text", "", item(a, j), "")
Anything <= 0 will be red, <=5 will be orange, <=10 will be green, and >10 will be blue.
Regards John
-
Thank you everyone!
With the help of I have found a solution of the case!
Content aside
- 2 wk agoLast active
- 20Replies
- 115Views
-
6
Following