Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
can someone help me plz? I need the following logic:
- In the apps on the lowest level, I will have a varying nr. of diagrams, each one with a status_light
- No matter how they are calculated, each status light should have red, yellow, green
- No matter how many individual stati there are (well, it's usually three, but it should be flexible), I need some way of
dynamically calculating an overall status along the following lines:
- All lights green => overall status is green
- One or more yellow, rest green => overall status is yellow
- One or more red, rest whatever => overall status is red
With just two lights, this is easy - people used to say, there is no middle way, so i had no difficulties. Three is a lot more complicated.
Thanks a lot!
Best regards,
DataNibbler
Hi,
I reckon with numbers I can never get there in an easy way:
- Say, I give 10 pts for red, 20 for yellow, 30 for green
=> All lights green would return 90 points
=> One light green, two yellow would yield 70 => The overall status should be yellow
<=> Two green lights, one red would also yield 70, but the overall status should be red
To make it more precise, I would have to repeat the calculation of each formula several times to calculate the overall status, that seems stupid to me.
I suppose I cannot assign letters instead of numbers to those gauges - doesn't seem to work anyway.
Couldn't I concatenate the results of the individual lights into a variable and then evaluate it (in that order) => Then I could say, like
- "Variable like 111 => overall_status is green"
- "Variable like 112 or 121 or 211 or ... => overall_status is yellow"
- "Variable like 113 or 131 or 311 or ... => overall_status is red"
=> That way, I'd have to query a few possible combinations, but it would still be easier - and more resource-friendly - than repeating the calculation of every one of the three formulas as many times...
Thanks a lot!
Best regards,
DataNibbler
Done 😉
Long live Feynman 😉