<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Obtain value of point in javascript.]]></title><description><![CDATA[<p dir="auto">I need to get the value of a point in the javascript of my component, to perform some operations. In HTML, can I do with the ma-point value, but in javascript?  Thank you</p>
]]></description><link>https://forum.mango-os.com/topic/4400/obtain-value-of-point-in-javascript</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 14:02:18 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4400.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Aug 2019 19:47:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Obtain value of point in javascript. on Fri, 16 Aug 2019 19:57:29 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">It's now the Nashorn engine as of Java 8</p>
</blockquote>
<p dir="auto">Noted!</p>
<p dir="auto">Thanks Phil, you da MVP ;)</p>
]]></description><link>https://forum.mango-os.com/post/23179</link><guid isPermaLink="true">https://forum.mango-os.com/post/23179</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Fri, 16 Aug 2019 19:57:29 GMT</pubDate></item><item><title><![CDATA[Reply to Obtain value of point in javascript. on Fri, 16 Aug 2019 18:45:31 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for helping out <a class="plugin-mentions-user plugin-mentions-a" href="/user/mattfox" aria-label="Profile: MattFox">@<bdi>MattFox</bdi></a> and <a class="plugin-mentions-user plugin-mentions-a" href="/user/pyeager" aria-label="Profile: pyeager">@<bdi>pyeager</bdi></a></p>
<p dir="auto">Couple comments,</p>
<blockquote>
<p dir="auto">No, this JavaScript is what runs inside rhino</p>
</blockquote>
<p dir="auto">It's now the Nashorn engine as of Java 8. If there are still Rhino references in the documentation I will remove them if I am aware of them.</p>
<p dir="auto">On the global script comment, I would encourage using global scripts only for defining functions or global variables. It looks like it probably was on <a class="plugin-mentions-user plugin-mentions-a" href="/user/pyeager" aria-label="Profile: pyeager">@<bdi>pyeager</bdi></a> 's system (otherwise 'source' is only going to be defined for Point Links and everything else will error while preparing the script engine), but that part may have been omitted.</p>
<blockquote>
<p dir="auto">I'm not certain if this is the right way to do it, bit it's 'a' way. You may find using the websockets and writing a handler to get the job done works better.</p>
</blockquote>
<p dir="auto">You could also define the point as an input of the component in its controller and then pass it in from existing components, such as was done in this thread: <a href="https://forum.infiniteautomation.com/topic/3503/how-to-chart-with-data-points-in-the-x-axis-instead-of-time/5" rel="nofollow ugc">https://forum.infiniteautomation.com/topic/3503/how-to-chart-with-data-points-in-the-x-axis-instead-of-time/5</a></p>
]]></description><link>https://forum.mango-os.com/post/23178</link><guid isPermaLink="true">https://forum.mango-os.com/post/23178</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Fri, 16 Aug 2019 18:45:31 GMT</pubDate></item><item><title><![CDATA[Reply to Obtain value of point in javascript. on Sun, 18 Aug 2019 22:46:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pyeager" aria-label="Profile: pyeager">@<bdi>pyeager</bdi></a> said in <a href="/post/23169">Obtain value of point in javascript.</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mattfox" aria-label="Profile: MattFox">@<bdi>MattFox</bdi></a></p>
<p dir="auto">Does the code above not work inside a module?</p>
</blockquote>
<p dir="auto">No, this JavaScript is what runs inside <s>rhino</s> nashorn and has access to Java methods (Hence the data point wrapper). The mango ui uses the rest api, hence why 3.6 can use the new ui to make various data sources and events and 3.5 cannot.</p>
<p dir="auto">For the code! Running on a few hours sleep here..</p>
<pre><code>componentContriller.$inject=['maPointValues'];

function componentController(maPointValues)
{
var opts={
latest:1,
fields:['VALUE','TIMESTAMP','XID'],
Rollup:'NONE'
};
 maPointValues.getPointValuesForXid('myXid',opts).then(function( values ){
console.log( values );
});
}
</code></pre>
<p dir="auto"><a href="https://github.com/infiniteautomation/ma-dashboards/blob/main/UI/web-src/ngMango/services/pointValues.js" rel="nofollow ugc">https://github.com/infiniteautomation/ma-dashboards/blob/main/UI/web-src/ngMango/services/pointValues.js</a></p>
<p dir="auto">I'm not certain if this is the right way to do it, bit it's 'a' way. You may find using the websockets and writing a handler to get the job done works better. YMMV</p>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/23176</link><guid isPermaLink="true">https://forum.mango-os.com/post/23176</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Sun, 18 Aug 2019 22:46:29 GMT</pubDate></item><item><title><![CDATA[Reply to Obtain value of point in javascript. on Fri, 16 Aug 2019 14:59:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mattfox" aria-label="Profile: MattFox">@<bdi>MattFox</bdi></a></p>
<p dir="auto">Does the code above not work inside a module?</p>
]]></description><link>https://forum.mango-os.com/post/23169</link><guid isPermaLink="true">https://forum.mango-os.com/post/23169</guid><dc:creator><![CDATA[pyeager]]></dc:creator><pubDate>Fri, 16 Aug 2019 14:59:39 GMT</pubDate></item><item><title><![CDATA[Reply to Obtain value of point in javascript. on Fri, 16 Aug 2019 14:39:50 GMT]]></title><description><![CDATA[<p dir="auto">Johana:</p>
<p dir="auto">You might find this helpful.  It is an example of a technique that I use in global scripts and scripting data sources.</p>
<pre><code>var query = "eq(deviceName," + source.name + ")&amp;eq(name,Auto Limit)";
var dataPoint = DataPointQuery.query( query );
if( dataPoint.size() )
{
    limit = dataPoint[0].runtime.value;
}
else
{
    LOG.info( source.name + ": Auto Throttle: Auto Limit data point not found ");
    return;
}
</code></pre>
<p dir="auto">I am not sure whether this works in your context, but perhaps it might be helpful.</p>
]]></description><link>https://forum.mango-os.com/post/23168</link><guid isPermaLink="true">https://forum.mango-os.com/post/23168</guid><dc:creator><![CDATA[pyeager]]></dc:creator><pubDate>Fri, 16 Aug 2019 14:39:50 GMT</pubDate></item><item><title><![CDATA[Reply to Obtain value of point in javascript. on Fri, 16 Aug 2019 12:53:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mattfox" aria-label="Profile: mattfox">@<bdi>mattfox</bdi></a><br />
Yes, I have created my components. In a parent component, I filter the points that I need and in a child component, I bind the point I need. Now, I need to make a logic with the point value in javascript.<br />
I would appreciate an example of using the maPointValues ​​service, thanks!</p>
]]></description><link>https://forum.mango-os.com/post/23167</link><guid isPermaLink="true">https://forum.mango-os.com/post/23167</guid><dc:creator><![CDATA[johana crisbany gamez]]></dc:creator><pubDate>Fri, 16 Aug 2019 12:53:25 GMT</pubDate></item><item><title><![CDATA[Reply to Obtain value of point in javascript. on Fri, 16 Aug 2019 12:17:12 GMT]]></title><description><![CDATA[<p dir="auto">You can, but you'll have to do it with leveraging an angularjs controller and storing it in the userModule module.<br />
<a href="https://help.infiniteautomation.com/getting-started-with-a-user-module?rq=usermodule" rel="nofollow ugc">https://help.infiniteautomation.com/getting-started-with-a-user-module?rq=usermodule</a><br />
You'll have to use the maPointValues service. I'm not near a pc so I am unable to provide a code example at this time.</p>
]]></description><link>https://forum.mango-os.com/post/23165</link><guid isPermaLink="true">https://forum.mango-os.com/post/23165</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Fri, 16 Aug 2019 12:17:12 GMT</pubDate></item></channel></rss>