Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
Script context points as enumerable
-
Hi,
I was wondering if there is any way to iterate over all context points in a meta datapoint script, without spelling them out?
I want to write a generic script that is oblivious to them but can still access their values.
E.g. dumping all their values to an error log if something goes wrong.
Thanks -
@till yes, have a look at the meta data source help. This is how you iterate over. Be aware that the meta point itself is contained in CONTEXT_POINTS.
for (var variableName in CONTEXT_POINTS) { print(CONTEXT_POINTS[variableName]); }
-
Sweet, thanks!
-
So I found this on CONTEXT_POINTS
CONTEXT_POINTS CONTEXT_POINTS is a variable declared in all scripting environments. It is a map of variable names to context point runtimes.
Is there more documentation somewhere?
.
Your example gives me a list of elements like this:
DataPointRT(id=1, name=MyPoint) DataPointRT(id=2, name=MyOtherPoint)
From there, how do I get to the full datapoint details, like value, last value, timestamp etc?
Where do I find out more about context point runtimes
Thanks
-
@till I am not 100% sure, but is this the type of information you need:
http://docs-v4.mango-os.com/about-mango-java-script
This is the main documentation site: http://docs-v4.mango-os.com/
-
@till try this -
for (var variableName in CONTEXT_POINTS) { print(this[variableName]); }
-
@jared-wiltshire perfect, thanks!