Just trying out something to see if it works, but I think I need an alternative way of doing it.
I understand that you can use number values only, but does that mean you can't change the values of a colour due to the commas and multiple number values?
eg: DiskNorm=255,255,255,180 FontColor=(((m#CURRENTSECTION#DiskRead=0)&&(m#CURRENTSECTION#DiskWrite=0))=0 ? #DiskNorm# : 0)
The zero at the end of the condition will be where I add the other conditions if I can.
Thanks
EDIT: Assuming it was possible, likely not, but let's say it is, would this be the correct syntax?
Is it incorrect syntax?
The Variables are correct as I'm using them elsewhere.
The 'UL' will be replaced with #CURRENTSECTION# once I know this is correct.
sl23 wrote: ↑July 18th, 2024, 12:11 pm
eg: DiskNorm=255,255,255,180 FontColor=(((m#CURRENTSECTION#DiskRead=0)&&(m#CURRENTSECTION#DiskWrite=0))=0 ? #DiskNorm# : 0)
The zero at the end of the condition will be where I add the other conditions if I can.
There are more issues with the posted formula:
A mathematical formula, used anywhere (in a Formula option of a Calc measure, in an IfCondition or into an any option, as you did) has to be ENTIRELY NUMERIC. Your DiskNorm variable (in fact any variable storing a color) is a string, even if it contains four numbers (besides the numbers, it has three commas, which are not allowed into numbers).
Besides this, even if the formula wouldn't return a string but a number and it could work by this, the formula itself has a condition check which doesn't make sense. This is what am I talking about: FontColor=(((m#CURRENTSECTION#DiskRead=0)&&(m#CURRENTSECTION#DiskWrite=0))=0 ? #DiskNorm# : 0). The red colored =0 doesn't match in the mathematical formula.
Finally, the numerical values returned by measures can be used simply only in Formula options of Calc measures and in IfConditions. Outside of these options you have to use them as section variables (this requires to add the DynamicVariables=1 option to the meter - or measure, why not? - where you want to use it). So not taking into account the previously mentioned issues, the above FontColor should contain those brackets, delimiting the section variables: FontColor=((([m#CURRENTSECTION#DiskRead]=0)&&([m#CURRENTSECTION#DiskWrite]=0))=0 ? #DiskNorm# : 0) and the meter should contain the DynamicVariables=1 option.
One more thing you definitely should take care of: the name of the meter in which you want to use this FontColor option should be the one you have used in the names of the mXXXDiskRead and mXXXDiskWrite measures (I assume it should be for instance C, to get the mCDiskRead and mCDiskWrite measure names).
Taking all this into account, a form of the above FontColor option which could work looks this way: FontColor=((([m#CURRENTSECTION#DiskRead]=0)&&([m#CURRENTSECTION#DiskWrite]=0)) ? 255 : 0),((([m#CURRENTSECTION#DiskRead]=0)&&([m#CURRENTSECTION#DiskWrite]=0)) ? 255 : 0),((([m#CURRENTSECTION#DiskRead]=0)&&([m#CURRENTSECTION#DiskWrite]=0)) ? 255 : 0),((([m#CURRENTSECTION#DiskRead]=0)&&([m#CURRENTSECTION#DiskWrite]=0)) ? 180 : 0). See that there are four different sections, each of them returning one elemnet of the color code. These elements are numbers and can be used into mathematical formulas.
Let's stop here for first. I don't go further with the question posted into your second post. I think for first we should fix the first issue, only then we should go further.
Thanks balala, that was a great help in understanding why it wasn't working and how to get it to work, much appreciated.
A quick comment on your points:
I did think that the commas were the problem here, hence my comment about that
On first reading, I was adamant this was correct, until I read the original code! lol Thanks for that.
This is one of the issues I have, knowing when and where but mainly WHY I need to use brackets.
This one I know well and am fully aware of it, thanks.
I really was just trying to learn some more about formulas and how they work, always loved maths at school
Never had a reason to use it my whole life though!
That final code seems overkill for using where I planned to, given there will be another twelve for Disk Read and Write variations!
Think I'll leave this as is. My aim was learning to use formulas to try condense things, least if that was a possibility, but I suppose it's not in all cases.
This is my working code at present, apart from the FontColor part obviously:
sl23 wrote: ↑July 18th, 2024, 9:14 pm
That final code seems overkill for using where I planned to, given there will be another twelve for Disk Read and Write variations!
To simplify and make things more compact, why not doing something like (basic syntax used below for simplicity):
In other words, instead of trying to set the color directly in the conditional, set its index (assuming that the color variables are defined using indexes, obviously), and then set the color based on that index, via the nested syntax.
Thanks, but I gave up on that! Starting to hurt my brain! lol
The second post is still something I would like to get sorted though.
And also, I'm trying to sort another skin with Shapes. Disk skin showing a simple line rather than a bar, but everything I try fails in one way or another. I tried Bars, but the line wouldn't show in the correct place. Now I'm using separate Shapes for each disk, despite it working perfectly fine, bit strange on the insert/removal as other drives hide during that process, but getting an errors on every update saying the formula is wrong for every drive unplugged!
This is one of the issues I have, knowing when and where but mainly WHY I need to use brackets.
As said the brackets are not needed into the Formula option of a Calc measure and in IfConditions. Use them everywhere else and don't forget about the dynamic variables.
Yincognito wrote: ↑July 19th, 2024, 10:00 am
To simplify and make things more compact, why not doing something like (basic syntax used below for simplicity):
In other words, instead of trying to set the color directly in the conditional, set its index (assuming that the color variables are defined using indexes, obviously), and then set the color based on that index, via the nested syntax.
Actually, that's pretty neat and may come in handy with other stuff! Thanks.