<?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[query on datapoint value]]></title><description><![CDATA[<p dir="auto">have been  getting datapoints for my chart using this:</p>
<p dir="auto">&lt;ma-point-query query="{$and: true, deviceName:'unit#1_plc', name:'jobNumber'}" limit="9" points="points"&gt;&lt;/ma-point-query&gt;</p>
<p dir="auto">but im really wanting the datapoints when "jobNumber=certainValue"</p>
<p dir="auto">can this be done?</p>
<p dir="auto">what about on only two devices    like:    deviceName:'unit#1_plc' or 'unit#2_plc'</p>
]]></description><link>https://forum.mango-os.com/topic/4754/query-on-datapoint-value</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 12:02:07 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4754.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Mar 2020 20:36:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to query on datapoint value on Wed, 25 Mar 2020 20:01:23 GMT]]></title><description><![CDATA[<p dir="auto">I think before we go further, you need to modify your naming convention...</p>
<p dir="auto">So you've got a system where techs are installing these systems, but there's no actual documentation on what's what??<br />
Sounds like an impending cluster...<br />
You're storing the batch number as a point value, as well as having four other points to hold sensor data, correct?<br />
Sounds like you need something to parse the data either before or in mango otherwise you're forever going to be chasing your tail.</p>
<p dir="auto">If you need to parse values you're going to have to write a controller to read these values and sort them into groups.</p>
<p dir="auto">EDIT: use a meta data source point for each PLC unit. get it to store the timestamps of when the batch number changes. That way you can create a dropdown of batch values, and filter them with a text box:</p>
<pre><code>//metapoint is settable, var name: batch, type alphanumeric
//context point, plc batch number point: batchNum
var curr = JSON.parse(batch.value);

if(!curr)
{
var batchObj = {batch:batchNum.value,
start:batchNum.time,
end:''}
return JSON.stringify( batchObj );
}
else
{
if(curr.batch == batchNum.value){return UNCHANGED;}
if(curr.batch !== batchNum.value)
{
   curr.end = batchNum.time;
   batch.set( JSON.stringify(curr), batch.time); //overwrite last value

   var batchObj = {batch:batchNum.value,
start:batchNum.time,
end:''}
return JSON.stringify( batchObj );
}
}

</code></pre>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/24971</link><guid isPermaLink="true">https://forum.mango-os.com/post/24971</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Wed, 25 Mar 2020 20:01:23 GMT</pubDate></item><item><title><![CDATA[Reply to query on datapoint value on Wed, 25 Mar 2020 17:13:58 GMT]]></title><description><![CDATA[<p dir="auto">I will try to expand on this:</p>
<p dir="auto">I have changed jobNumber to batchNumber to help clarify</p>
<p dir="auto">There are several plc's , each one at different site. Each has 5 datapoints that we want.<br />
(4 sensors and 1  batchNumber)<br />
Using a modbus datasource, we are retreiving and logging these once per sec into mango on office laptop.<br />
Batch numbers are generated on site so the office has no idea which plc has which batches or when they were done.</p>
<p dir="auto">batch#, 	ch1,  ch2,  ch3,  ch4</p>
<p dir="auto">404	 	63	 67	  48	78<br />
404	 	63	 67	  48	78</p>
<p dir="auto">405	 	63	 67	  48	78<br />
405	 	63	 67	  48	78<br />
405	 	63	 67	  48	78<br />
405	 	63	 67	  48	78</p>
<p dir="auto">612  	63	 67	  48	78<br />
612	 	63	 67	  48	78<br />
612	 	63	 67	  48	78<br />
612	 	63	 67	  48	78</p>
<p dir="auto">on and on every second...</p>
<p dir="auto">back at the office, the supervisor types in batch number he wants into  mango dashboard. This could be a batch from 1 week ago, lets say batch #405.<br />
We need to find the device with #405 on it and put the 4 sensor readings into the serialChart input array for graphical viewing.Keep doing this until a historical graph is built<br />
We have a customized serialChart which views realtime very nicely, but its the historical data that im having trouble with.</p>
<p dir="auto">hence my request for a query that compares a datapoint value on the plc</p>
]]></description><link>https://forum.mango-os.com/post/24970</link><guid isPermaLink="true">https://forum.mango-os.com/post/24970</guid><dc:creator><![CDATA[dgm]]></dc:creator><pubDate>Wed, 25 Mar 2020 17:13:58 GMT</pubDate></item><item><title><![CDATA[Reply to query on datapoint value on Tue, 24 Mar 2020 23:57:39 GMT]]></title><description><![CDATA[<p dir="auto">Change your query based upon the watchlist builder:</p>
<p dir="auto">For your datapoints if the required number is selected:</p>
<pre><code>&lt;label&gt;Select Job number:&lt;/label&gt;
&lt;md-select ng-model="jobNumber"&gt; &lt;md-option value="0"&gt;0&lt;/md-option&gt;&lt;md-option value="1"&gt;1&lt;/md-option&gt;&lt;/md-select&gt;
&lt;ma-point-query ng-if="jobNumber==1" query="'eq(deviceName,unit#1_plc)&amp;eq(name,1)&amp;limit(9)'" points="points"&gt;&lt;/ma-point-values&gt;
</code></pre>
<p dir="auto">For two devices:</p>
<pre><code>&lt;ma-point-query query="'or(eq(deviceName,unit#1_plc),eq(deviceName,unit#2_plc))&amp;limit(2)'" points="points"&gt;&lt;/ma-point-values&gt;
</code></pre>
<p dir="auto">You'll need to expand more on what you're trying to achieve to get the correct queries if I've missed something</p>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/24962</link><guid isPermaLink="true">https://forum.mango-os.com/post/24962</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Tue, 24 Mar 2020 23:57:39 GMT</pubDate></item></channel></rss>