I’m trying to set up my single number analysis to display red or green depending on logic I want to create. How would this be done? I tried using a trigger for when the app is started, but I’m not able to see the analysis as an option for the If part.
Hi, thanks for your question about coloring the Single Number Analysis widget. You can’t reference the Analysis directly in a trigger. Instead, store the same value powering the analysis in a number variable (like TRIR_Value), and write a trigger to set a text variable (like ColorCode) based on that value. In the widget settings, set the color to be controlled by ColorCode. This lets you apply logic like: if TRIR_Value > 2, set ColorCode to “Red”, else set it to “Green”. Let me know if you want help wiring that up.
Hi, so far I have done the following:
Created a number variable called TRIR value and set the default value to 2.0. The data source for this TRIR value I’m unsure about. At the moment, I set it as the TRIR table record from the safety table I created.
Next I created a variable called TRIR color.
I made my analysis color be transparent because I have TRIR value behind it.
I made a trigger you see below.
When I test, there is no color change. I’m positive I did not get everything right the first time, so please help me fix where I went wrong.
Thanks for your support!
Hi Cody,
You’re close! Here’s what to fix:
- Make sure
TRIR color
is a Color variable, not Text. - Load the actual TRIR value from your Safety table into the
TRIR value
variable using a Load Table Record + Store action. - Use one trigger to compare
TRIR value
:
- If
>= 2
, store Red intoTRIR color
- Else, store Green
- In the widget, set the color to use the
TRIR color
variable (not transparent).
That should make the color change work. Let me know if you want help setting up the data load.
Hi,
- Done
- Not sure what is meant here by “Load Table Record + Store action”. Please clarify. I added the table record TRIR <2.0 as a variable, but that didn’t do anything.
- Done
- Done
Never mind. I got it now lol.
Thank you very much for your support on this!