Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello,
The stateDefinition object that I gave the advanced grid is not doing what I want it to do.
State Definition:
"stateDefinition": {
"fieldName": "example",
"name": "example_alarm",
"type": "non-fixed",
"states": [
{
"comparator": "<",
"name": "min_value",
"styleName": LowStyle",
"value": "10"
},
{
"comparator": ">",
"name": "max_value",
"styleName": "HighStyle",
"value": "100"
}
]
}
I am using the exact same layout for the string type columns of my grid and it behaves the way I want it to, since I am using the "==" comparator.
However for my number type columns, I am not getting the range that I want. The outcome is as if the comparator was "==".
Now I realised that the value I gave it was a string, so I changed it to:
"stateDefinition": {
"fieldName": "example",
"name": "example_alarm",
"type": "non-fixed",
"states": [
{
"comparator": "<",
"name": "min_value",
"styleName": LowStyle",
"value": 10
},
{
"comparator": ">",
"name": "max_value",
"styleName": "HighStyle",
"value": 100
}
]
}
And now it does not work at all. Even though my defined column type and the data shape types all match (number).
Solved! Go to Solution.
Hi @AC_10450068.
We tested this under 9.3.6 and it appears to be working as expected in that release. We used the AdvancedGrid sample file and tested both converted and unconverted.
Did it work for you before making changes? Did you test it immediately after the conversion before modifying the style definitions?
Regards.
--Sharon
Hello,
This should work as Javascript will first convert the string to a number before the comparison.
However I am not entirely sure how the grid handles the same situation.
You say you are using the "==" comparator, but in the configs you have provided you are not using it.
I am not really experienced using these grid configurations, but from what I can tell if your data is a number the second config should work.
Do you get any errors in the developer console or script/application logs?
Regards,
Jens
Hello Jens,
Sorry for being unclear. The problem I am having is that it behaves as if I have used the "==" comparator, even though my config contains a different once.
Hi @AC_10450068.
Which version of ThingWorx are you running? It seems to work under the latest release of ThingWorx.
Did you check for the possibility of typos?
Regards.
--Sharon
Hello slangley,
I am using ThingWorx 9.3.0-b20. I have looked over the possibility of typos but I managed to replicate the problem using the AdvancedGridExample:
Same question:
Hi @AC_10450068.
We tested this under 9.3.6 and it appears to be working as expected in that release. We used the AdvancedGrid sample file and tested both converted and unconverted.
Did it work for you before making changes? Did you test it immediately after the conversion before modifying the style definitions?
Regards.
--Sharon