<?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[maJsonStore (JSON store)]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">With the dashboards I'm designing, I've managed to store my data points I want to look at in an array, which is geat for the one overview page, but now I'm looking at making detail page(s), which uses some of the same datapoints.</p>
<p dir="auto">I'm wondering if the <code>ma-json-store</code> is a better place to save the details of the datapoints - it's actually an array of arrays which is formatted thus:</p>
<pre><code>    DataPoints=[
        {ID:'001',Location:'Lot 17',URL:'/ui/lot17',CustomerLoad:'001DP_POD-827990', PV:'001DP-8212690',PVMax:'DP_008082',GenRun:'DP_812',BattCharge:'684160',BattTemp:'4275',FuelLevel:'9842',GenOutput: '37690'}
       ,{ID:'002',Location:'Lot 860',URL:'/ui/lot860',CustomerLoad:'7990',PV:'2690',PVMax:'008082',GenRun:'2852',BattCharge:'44800',BattTemp:'444275',FuelLevel:'999842',GenOutput: '767690'}
(etc, for another 10 or so points)
]
</code></pre>
<p dir="auto">Where the second value is the XID of the datapoint I'm addressing (I've snipped a lot down so it doesn't look so messy!)</p>
<p dir="auto">Before I plunge in and move everything around - I was curious if the JSON store could save the information in this state, or whether I'd need to change it's format somewhat - and also how I (or someone else) could administer these points when new MangoES are added. I've seen some rudimentary documentation on the component, but was also curious if there was some more detailed/advanced examples beyond the <a href="http://localhost:8080/ui/docs/ng-mango/ma-json-store" rel="nofollow ugc">http://localhost:8080/ui/docs/ng-mango/ma-json-store</a> ?</p>
<p dir="auto">Thanks</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/topic/4174/majsonstore-json-store</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 22:36:21 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4174.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Apr 2019 03:58:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to maJsonStore (JSON store) on Mon, 10 Jun 2019 04:56:57 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> said in <a href="/post/22349">maJsonStore (JSON store)</a>:</p>
<blockquote>
<p dir="auto">@richard-mortimer I believe when you did <code> | number:1</code> and <code>| number:0</code> was more than sufficient. alternatively just use <code>point.value.toFixed(1)</code> and <code>point.value.toFixed()</code> repectively</p>
</blockquote>
<p dir="auto">Thanks - the colon in the <code> | number:1</code> was interfering with the ternary operator and getting it confused; so, while I could pipe it through, I couldn't modify the final number based on which direction it took - the <code>point.value.toFixed(1)</code>  did the correct thing for me ...</p>
<p dir="auto">Cheers</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22363</link><guid isPermaLink="true">https://forum.mango-os.com/post/22363</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Mon, 10 Jun 2019 04:56:57 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Fri, 07 Jun 2019 15:22:15 GMT]]></title><description><![CDATA[<p dir="auto">@richard-mortimer said in <a href="/post/22346">maJsonStore (JSON store)</a>:</p>
<blockquote>
<p dir="auto">Any idea how to put the number filter in there? The kW was to one decimal place, and the W was to 0 ...</p>
</blockquote>
<p dir="auto">You would need another ternary operator. IMO the way you had it in the first place is easier to read.</p>
<p dir="auto">If you use this pattern often, consider adding an AngularJS filter to a user module. You could then use it just like<br />
<code>&lt;span ng-bind="point.value | formatPower"&gt;&lt;/span&gt;</code></p>
]]></description><link>https://forum.mango-os.com/post/22352</link><guid isPermaLink="true">https://forum.mango-os.com/post/22352</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Fri, 07 Jun 2019 15:22:15 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Fri, 07 Jun 2019 07:31:37 GMT]]></title><description><![CDATA[<p dir="auto">@richard-mortimer I believe when you did <code> | number:1</code> and <code>| number:0</code> was more than sufficient. alternatively just use <code>point.value.toFixed(1)</code> and <code>point.value.toFixed()</code> repectively</p>
]]></description><link>https://forum.mango-os.com/post/22349</link><guid isPermaLink="true">https://forum.mango-os.com/post/22349</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Fri, 07 Jun 2019 07:31:37 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Fri, 07 Jun 2019 06:43:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craigweb" aria-label="Profile: craigweb">@<bdi>craigweb</bdi></a> said in <a href="/post/22314">maJsonStore (JSON store)</a>:</p>
<blockquote>
<pre><code>&lt;span ng-repeat="point in points"&gt;
    &lt;ma-get-point-value point-xid="{{ point.xid }}" point="output"&gt;&lt;/ma-get-point-value&gt;
    &lt;div&gt;{{output.value &gt;1000? output.value/1000:output.value}}{{output.value &gt;1000?'kW':'W'}}&lt;/div&gt;
&lt;/div&gt;
</code></pre>
</blockquote>
<p dir="auto">Sorry, I missed this reply - you are correct it's inside a larger loop, which iterates through each device - I'm going to try the ternary operator and see how that goes ...</p>
<p dir="auto">Any idea how to put the <code>number</code> filter in there? The <code>kW</code> was to one decimal place, and the <code>W</code> was to 0 ...</p>
<p dir="auto">Cheers</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22346</link><guid isPermaLink="true">https://forum.mango-os.com/post/22346</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Fri, 07 Jun 2019 06:43:19 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Thu, 06 Jun 2019 00:49:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jared-wiltshire" aria-label="Profile: jared-wiltshire">@<bdi>jared-wiltshire</bdi></a> said in <a href="/post/22315">maJsonStore (JSON store)</a>:</p>
<blockquote>
<p dir="auto">Two things -</p>
<ul>
<li>Use <code>track by</code> in your <code>ng-repeat</code> expression so that Angular can correlate which points correspond to each span element when the points change.</li>
<li>Just pass the point to the <code>&lt;ma-get-point-value&gt;</code> component instead of retrieving it by XID again</li>
</ul>
</blockquote>
<p dir="auto">Thanks for that - I've made the changes and will keep an eye on it; unfortunately it only seems to happen at random times which makes it one of those "fun" bugs to iron out  ... but I'm pretty confident that if <em>you're</em> pretty confident, it will probably be the right solution! :)</p>
<p dir="auto">Cheers!!</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22320</link><guid isPermaLink="true">https://forum.mango-os.com/post/22320</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Thu, 06 Jun 2019 00:49:20 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 16:14:09 GMT]]></title><description><![CDATA[<p dir="auto">@richard-mortimer I'm taking a guess at what is happening, but I'm pretty confident that this will fix it -</p>
<pre><code>&lt;span ng-repeat="point in points[site.name] track by point.xid"&gt;&lt;!-- Load --&gt;
    &lt;ma-get-point-value point="point"&gt;&lt;/ma-get-point-value&gt;
    &lt;div ng-if="point.value &gt; 1000"&gt;{{ (point.value / 1000) | number:1 }}kW&lt;/div&gt;
    &lt;div ng-if="point.value &lt;= 1000"&gt;{{ point.value | number:0 }}W&lt;/div&gt;
&lt;/span&gt;&lt;!-- end Load --&gt;
</code></pre>
<p dir="auto">Two things -</p>
<ul>
<li>Use <code>track by</code> in your <code>ng-repeat</code> expression so that Angular can correlate which points correspond to each span element when the points change.</li>
<li>Just pass the point to the <code>&lt;ma-get-point-value&gt;</code> component instead of retrieving it by XID again</li>
</ul>
]]></description><link>https://forum.mango-os.com/post/22315</link><guid isPermaLink="true">https://forum.mango-os.com/post/22315</guid><dc:creator><![CDATA[Jared Wiltshire]]></dc:creator><pubDate>Wed, 05 Jun 2019 16:14:09 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 10:35:11 GMT]]></title><description><![CDATA[<p dir="auto">@richard-mortimer Hi</p>
<p dir="auto">I don't think you need to user parseInt etc as javascript will evaluate it as a number when there is a comparator.</p>
<p dir="auto">I tested this out with this code and got the desirable outcome</p>
<pre><code>&lt;div class="ma-designer-root" id="ad15c8a3-1798-45ab-9771-535bb550b828" style="width: 1366px; height: 768px; position: relative;" ng-init="points=[
    {xid:'DP_3414e074-39ae-4179-b3e7-0775e7cabc54'},
    {xid:'DP_a7485f76-5c52-4c42-b49a-f17b3276a2f8'}]"&gt;
    
    
&lt;span ng-repeat="point in points"&gt;
    
    &lt;ma-get-point-value point-xid="{{ point.xid }}" point="output"&gt;&lt;/ma-get-point-value&gt;
    &lt;div ng-if="output.value &gt; 999"&gt;{{ (output.value / 1000) }}kW&lt;/div&gt;
    &lt;div ng-if="output.value &lt; 1000"&gt;{{ (output.value)}}W&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto">If you look at your screen shot where the 'error" happens , 1.4kW is from the previous ng-repeat itteration.<br />
We can't see the rest of your code but by the looks of it, you have a table with nested repeats.  I think you should refactor your code using <code>  ng-repeat-start</code>   and <code>  ng-repeat-end</code>   for all you nested repeats just to make sure the browser does not get confused.</p>
<p dir="auto">Edit:<br />
Another way to skin this cat would be to use a ternary expression.</p>
<pre><code>&lt;div class="ma-designer-root" id="ad15c8a3-1798-45ab-9771-535bb550b828" style="width: 1366px; height: 768px; position: relative;" ng-init="points=[
    {xid:'DP_3414e074-39ae-4179-b3e7-0775e7cabc54'},
    {xid:'DP_a7485f76-5c52-4c42-b49a-f17b3276a2f8'}]"&gt;
    
    
&lt;span ng-repeat="point in points"&gt;
    &lt;ma-get-point-value point-xid="{{ point.xid }}" point="output"&gt;&lt;/ma-get-point-value&gt;
    &lt;div&gt;{{output.value &gt;1000? output.value/1000:output.value}}{{output.value &gt;1000?'kW':'W'}}&lt;/div&gt;
&lt;/div&gt;
</code></pre>
]]></description><link>https://forum.mango-os.com/post/22314</link><guid isPermaLink="true">https://forum.mango-os.com/post/22314</guid><dc:creator><![CDATA[CraigWeb]]></dc:creator><pubDate>Wed, 05 Jun 2019 10:35:11 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 07:26:13 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> said in <a href="/post/22312">maJsonStore (JSON store)</a>:</p>
<blockquote>
<p dir="auto">Sorry Richard, I'm not seeing anything sticking out here.</p>
<p dir="auto">Fox</p>
</blockquote>
<p dir="auto">That's cool - I'm kinda glad it wasn't something glaringly obvious, and I appreciate your help!!</p>
<p dir="auto">Getting a couple of errors, but I'm not sure they are related:</p>
<p dir="auto"><img src="https://camo.nodebb.org/85eae97f6cb44e7534ba651257ca5af61dabb974?url=https%3A%2F%2Fi.imgur.com%2FipRG2OM.jpg" alt="0_1559720264023_console_output.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">Cheers</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22313</link><guid isPermaLink="true">https://forum.mango-os.com/post/22313</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Wed, 05 Jun 2019 07:26:13 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 06:58:24 GMT]]></title><description><![CDATA[<p dir="auto">Sorry Richard, I'm not seeing anything sticking out here. The only thoughts I have is echoing out <code>{{output}}</code> inbetween both of the ng-if divs. Seeing how you're having two appear in one area makes me wonder if there's some sort of overlap or something stupid. Your values are definitely numeric.<br />
The next best idea Ive got is checking your console after doing a page load to see if any angular errors crop up..<br />
Otherwise I'm gonna have to call on Jared or Phil to help here. Sorry I cannot be of any further assistance. Either that or I'm just simply half asleep and it's staring me in the face!</p>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/22312</link><guid isPermaLink="true">https://forum.mango-os.com/post/22312</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Wed, 05 Jun 2019 06:58:24 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 06:46:00 GMT]]></title><description><![CDATA[<p dir="auto"><code>{{output}}</code> is:</p>
<pre><code>{
   "id":2986,
   "xid":"S2.DP_HOD-002_827990",
   "name":"Customer Load - Active Power",
   "enabled":true,
   "deviceName":"H02 - B-30",
   "readPermission":"RO, user",
   "setPermission":"",
   "pointFolderId":387,
   "purgeOverride":false,
   "unit":"W",
   "useIntegralUnit":false,
   "useRenderedUnit":false,
   "pointLocator":{
      "dataType":"NUMERIC",
      "settable":false,
      "modelType":"PL.PERSISTENT",
      "relinquishable":false
   },
   "chartColour":"black",
   "plotType":"SPLINE",
   "loggingProperties":{
      "loggingType":"ALL",
      "tolerance":0,
      "discardExtremeValues":false,
      "overrideIntervalLoggingSamples":false,
      "cacheSize":1
   },
   "textRenderer":{
      "useUnitAsSuffix":true,
      "unit":"W",
      "renderedUnit":"W",
      "format":"####.##",
      "suffix":"",
      "type":"textRendererAnalog"
   },
   "chartRenderer":{
      "timePeriod":{
         "periods":1,
         "type":"DAYS"
      },
      "type":"chartRendererImage"
   },
   "rollup":"NONE",
   "simplifyType":"NONE",
   "simplifyTolerance":10,
   "simplifyTarget":5000,
   "templateXid":null,
   "dataSourceId":116,
   "dataSourceXid":"DS_Central_T_E01",
   "dataSourceName":"Central-T-E01",
   "dataSourceTypeName":"PERSISTENT",
   "tags":{
      "SiteName":"S002",
      "Display":"Customer Load"
   },
   "lastPayload":{
      "xid":"SPS002.DP_HOD-002_827990",
      "event":"UPDATE",
      "value":{
         "dataType":"NUMERIC",
         "value":118,
         "timestamp":1559717556655,
         "annotation":null
      },
      "renderedValue":"118 W",
      "convertedValue":118,
      "enabled":true,
      "attributes":{
         "UNRELIABLE":false
      }
   },
   "value":118,
   "time":1559717556655,
   "convertedValue":118,
   "renderedValue":"118 W",
   "unreliable":false
}
</code></pre>
<p dir="auto">Thanks</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22311</link><guid isPermaLink="true">https://forum.mango-os.com/post/22311</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Wed, 05 Jun 2019 06:46:00 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 06:36:43 GMT]]></title><description><![CDATA[<p dir="auto">Ok, I can't replicate it. Let's go back to how you had it.<br />
But make it this for your ng-ifs</p>
<pre><code>&lt;span ng-repeat="point in points[site.name]"&gt;&lt;!-- Load --&gt;
    &lt;ma-get-point-value point-xid="{{ point.xid }}" point="output"&gt;&lt;/ma-get-point-value&gt;
&lt;div ng-if="output.value &gt; 1000"&gt;{{ (output.value / 1000) | number:1 }}kW&lt;/div&gt;
    &lt;div ng-if="output.value &lt; 1001"&gt;{{ output.value | number:0 }}W&lt;/div&gt;&lt;/span&gt;&lt;!-- end Load --&gt;
</code></pre>
<p dir="auto">Just humour me please.</p>
<p dir="auto">EDIT: Could you also please give me a copy of the <code>{{output}}</code> for the problem one?</p>
]]></description><link>https://forum.mango-os.com/post/22310</link><guid isPermaLink="true">https://forum.mango-os.com/post/22310</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Wed, 05 Jun 2019 06:36:43 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 06:22:57 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> said in <a href="/post/22308">maJsonStore (JSON store)</a>:</p>
<blockquote>
<pre><code>{{ typeof output.value }} //although i'm not confident if it will work...
</code></pre>
</blockquote>
<p dir="auto">Nope, that didn't work ... :(</p>
]]></description><link>https://forum.mango-os.com/post/22309</link><guid isPermaLink="true">https://forum.mango-os.com/post/22309</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Wed, 05 Jun 2019 06:22:57 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 06:21:19 GMT]]></title><description><![CDATA[<p dir="auto">I'll just have a quick look in the mango dash to see fi I can run some tests.<br />
As for typeof you want: note javascript generally has a numeric. doesn't have ints or floats like compiled languages.</p>
<pre><code>{{ typeof output.value }} //although i'm not confident if it will work...
</code></pre>
]]></description><link>https://forum.mango-os.com/post/22308</link><guid isPermaLink="true">https://forum.mango-os.com/post/22308</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Wed, 05 Jun 2019 06:21:19 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 06:18:30 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> said in <a href="/post/22306">maJsonStore (JSON store)</a>:</p>
<blockquote>
<p dir="auto">Evening Richard!</p>
<p dir="auto">Are your points numeric types or alphanumeric?</p>
<p dir="auto">I say keep it simple and just do</p>
<pre><code>&lt;span ng-repeat="point in points[site.name]"&gt;&lt;!-- Load --&gt;
    &lt;ma-get-point-value point-xid="{{ point.xid }}" point="output"&gt;&lt;/ma-get-point-value&gt;
    &lt;div ng-if="parseInt(output.value) &gt; 1000"&gt;{{  parseFloat(output.value / 1000).toFixed(1) }}kW&lt;/div&gt;
    &lt;div ng-if="parseInt(output.value) &lt;= 1000"&gt;{{ Number(output.value)}}W&lt;/div&gt;
&lt;/span&gt;&lt;!-- end Load --&gt;
</code></pre>
</blockquote>
<p dir="auto">I believed they were simply numeric - but whern I add the <code>parseInt(output.value)</code> everything disappears (as in - neither <code>ng-if</code> statement is true), similarly the same with the <code>Number</code> and <code>parseFloat</code> functions ...</p>
<p dir="auto">If I do: <code>&lt;script&gt;console.log(typeof {{output.value}});&lt;/script&gt;</code> I get:<br />
<img src="https://camo.nodebb.org/6184a29a44d492cecd0b19c34d9434c487b202ae?url=https%3A%2F%2Fi.imgur.com%2F8XUPtqQ.jpg" alt="0_1559716204069_syntax_error1.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">Cheers</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22307</link><guid isPermaLink="true">https://forum.mango-os.com/post/22307</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Wed, 05 Jun 2019 06:18:30 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 06:01:17 GMT]]></title><description><![CDATA[<p dir="auto">Evening Richard!</p>
<p dir="auto">Are your points numeric types or alphanumeric?</p>
<p dir="auto">I say keep it simple and just do</p>
<pre><code>&lt;span ng-repeat="point in points[site.name]"&gt;&lt;!-- Load --&gt;
    &lt;ma-get-point-value point-xid="{{ point.xid }}" point="output"&gt;&lt;/ma-get-point-value&gt;
    &lt;div ng-if="parseInt(output.value) &gt; 1000"&gt;{{  parseFloat(output.value / 1000).toFixed(1) }}kW&lt;/div&gt;
    &lt;div ng-if="parseInt(output.value) &lt;= 1000"&gt;{{ Number(output.value)}}W&lt;/div&gt;
&lt;/span&gt;&lt;!-- end Load --&gt;
</code></pre>
<p dir="auto">You don't have to use what I put int the div inner HTML. But as far as the ng-if is concerned at least you'd have a consistent read with your values.</p>
]]></description><link>https://forum.mango-os.com/post/22306</link><guid isPermaLink="true">https://forum.mango-os.com/post/22306</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Wed, 05 Jun 2019 06:01:17 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 05 Jun 2019 05:58:05 GMT]]></title><description><![CDATA[<p dir="auto">Sorry to drag up an old subject, but I've got a curious thing happening within my repeats - and I'm not sure if it's an Angular issue, or I've done something to upset it ...</p>
<p dir="auto">My code used two <code>ng-if</code> statements to determine if the value is output value is in watts or kilowatts, thus:</p>
<pre><code>&lt;span ng-repeat="point in points[site.name]"&gt;&lt;!-- Load --&gt;
    &lt;ma-get-point-value point-xid="{{ point.xid }}" point="output"&gt;&lt;/ma-get-point-value&gt;
    &lt;div ng-if="output.value &gt; 1000"&gt;{{ (output.value / 1000) | number:1 }}kW&lt;/div&gt;
    &lt;div ng-if="output.value &lt;= 1000"&gt;{{ output.value | number:0 }}W&lt;/div&gt;
&lt;/span&gt;&lt;!-- end Load --&gt;
</code></pre>
<p dir="auto">The problem is - I'm sometimes getting two values returned, (for example 984W and 1kW) - if I directyly print the value on the screen via <code>{{ output.value }}</code> I'm seeing what I would expect to see (mostly integers, a couple of float types for some points).</p>
<p dir="auto">Am I doing something wrong here, or is there a better way to do this?</p>
<p dir="auto">[edit] Here's one I managed to catch as it happened:<img src="https://camo.nodebb.org/8d0bede174bbecdc2a103f54291e83090bb8198a?url=https%3A%2F%2Fi.imgur.com%2FzA5bE95.jpg" alt="0_1559714978372_output_error.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">Thanks</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22305</link><guid isPermaLink="true">https://forum.mango-os.com/post/22305</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Wed, 05 Jun 2019 05:58:05 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 15 May 2019 08:43:33 GMT]]></title><description><![CDATA[<p dir="auto">I agree with Mattfox and I think Richard will be more familiar since you can code pure javascript functions in the component controller to manipulate your data.  instead of pseudo angular/javascript</p>
<p dir="auto">I believe you are safe to use <code>points="points"</code> unless <code>points</code> is initiated somewhere else in the ng-repeats parent scope.  As ng-repeat creates a scope for each iteration but will first look in the parent scope for <code>points</code></p>
]]></description><link>https://forum.mango-os.com/post/22143</link><guid isPermaLink="true">https://forum.mango-os.com/post/22143</guid><dc:creator><![CDATA[CraigWeb]]></dc:creator><pubDate>Wed, 15 May 2019 08:43:33 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 15 May 2019 06:54:30 GMT]]></title><description><![CDATA[<p dir="auto">@richard-mortimer said in <a href="/post/22141">maJsonStore (JSON store)</a>:</p>
<blockquote>
<p dir="auto">&lt;div style="border:2px solid blue;" ng-repeat="site in sites.sites"&gt;<br />
&lt;ma-point-query query="'eq(tags.SiteName,SPS001)&amp;eq(tags.Display,Customer Load)'" points="points" &gt;&lt;/ma-point-query&gt;<br />
&lt;!-- show me everything --&gt;<br />
&lt;div style="color: white;background-color:black; border: 1px solid red;"&gt;--{{ <a href="http://site.name" rel="nofollow ugc">site.name</a> }}--&lt;pre&gt;{{ points }}&lt;/pre&gt;--&lt;/div&gt;<br />
&lt;/div&gt;</p>
</blockquote>
<p dir="auto">Yikes, you're repeating your queries multiple times and calling the same data. We may need to start moving you into angularJS component territory.<br />
However, if you're after that site name, you need to do this:</p>
<pre><code>&lt;ma-json-store xid="sitesDataXID" value="sites"&gt;&lt;/ma-json-store&gt;
&lt;div style="border:2px solid blue;" ng-repeat="site in sites.sites"&gt;
    &lt;ma-point-query query="'eq(tags.SiteName,'+site.name+')&amp;eq(tags.Display,Customer Load)'" points="points[site.name]" &gt;&lt;/ma-point-query&gt;
    &lt;!-- show me everything in this point! --&gt;
    &lt;div style="color: white;background-color:black; border: 1px solid red;"&gt;--{{ site.name }}--&lt;pre&gt;{{ points[site.name] }}&lt;/pre&gt;--&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto">if you have <code>points="points"</code> being used every time for each of your ma-point-query items, they'll continue to be updated and overwrite one another as they all share the same scope.<br />
Storing them in an object using the site name as the key makes it a bit easier.<br />
or alternatively!</p>
<pre><code>&lt;ma-json-store xid="sitesDataXID" value="sites"&gt;&lt;/ma-json-store&gt;
&lt;div style="border:2px solid blue;" ng-repeat="(index,site) in sites.sites"&gt;
    &lt;ma-point-query query="'eq(tags.SiteName,'+site.name+')&amp;eq(tags.Display,Customer Load)'" points="points[index]" &gt;&lt;/ma-point-query&gt;
    &lt;!-- show me everything in this point! --&gt;
    &lt;div style="color: white;background-color:black; border: 1px solid red;"&gt;--{{ site.name }}--&lt;pre&gt;{{ points[index] }}&lt;/pre&gt;--&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto">This will map everything by the index in your JSON store.<br />
Let me know how you go.</p>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/22142</link><guid isPermaLink="true">https://forum.mango-os.com/post/22142</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Wed, 15 May 2019 06:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Wed, 15 May 2019 06:17:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craigweb" aria-label="Profile: craigweb">@<bdi>craigweb</bdi></a> said in <a href="/post/22106">maJsonStore (JSON store)</a>:</p>
<blockquote>
<p dir="auto">Hi Richard</p>
<p dir="auto">There is no operatore for your second criteria. This should work</p>
<pre><code>&lt;ma-point-query query="'eq(tags.SiteName,SPS001)&amp;eq(tags.Display,Customer Load)'" points="points" &gt;&lt;/ma-point-query&gt;
</code></pre>
</blockquote>
<p dir="auto">Thanks - that was the syntax I was after; I couldn't see anything like i in the RQL syntax: <a href="https://cubicweb.readthedocs.io/en/3.26/book/annexes/rql/language/#rql" rel="nofollow ugc">https://cubicweb.readthedocs.io/en/3.26/book/annexes/rql/language/#rql</a></p>
<p dir="auto">Is there somewhere that I can read about this??</p>
<p dir="auto">Also I note that in my nested repeats, this will work, and display all the relevant info for a single point:</p>
<pre><code>&lt;ma-json-store xid="sitesDataXID" value="sites"&gt;&lt;/ma-json-store&gt;
&lt;div style="border:2px solid blue;" ng-repeat="site in sites.sites"&gt;
    &lt;ma-point-query query="'eq(tags.SiteName,SPS001)&amp;eq(tags.Display,Customer Load)'" points="points" &gt;&lt;/ma-point-query&gt;
    &lt;!-- show me everything --&gt;
    &lt;div style="color: white;background-color:black; border: 1px solid red;"&gt;--{{ site.name }}--&lt;pre&gt;{{ points }}&lt;/pre&gt;--&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto"><img src="https://camo.nodebb.org/46d8ba50f7b9fb799a00313e86aeab4f70bb86e3?url=https%3A%2F%2Fi.imgur.com%2FcJnF61h.png" alt="0_1557900229406_cycle1.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Yet if I change the tag.SiteName to <code>{{site.name}}</code> thus:</p>
<pre><code>&lt;ma-json-store xid="sitesDataXID" value="sites"&gt;&lt;/ma-json-store&gt;
&lt;div style="border:2px solid blue;" ng-repeat="site in sites.sites"&gt;
    &lt;ma-point-query query="'eq(tags.SiteName,{{site.name}})&amp;eq(tags.Display,Customer Load)'" points="points" &gt;&lt;/ma-point-query&gt;
    &lt;!-- show me everything --&gt;
    &lt;div style="color: white;background-color:black; border: 1px solid red;"&gt;--{{ site.name }}--&lt;pre&gt;{{ points }}&lt;/pre&gt;--&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto">I'm getting this:</p>
<p dir="auto"><img src="https://camo.nodebb.org/10cb4e16967a8a11f3b98dee2d6b52b7ed798f1f?url=https%3A%2F%2Fi.imgur.com%2FGc7GofA.png" alt="0_1557900459270_cycle2.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Although the browsers (Firefox) code inspector displays the code as it should:</p>
<p dir="auto"><img src="https://camo.nodebb.org/722308bbcfc9771bc10f2fa39fb30afdab381b93?url=https%3A%2F%2Fi.imgur.com%2FSwDYnTf.png" alt="0_1557901439677_cycle3.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">So - should that work as I have it, or does Angular not allow variable substitution in this manner? I al;so tried to do it with <code>' + {{site.name}} + '</code> and a few variations (but clearly not the right one!)</p>
<blockquote>
<p dir="auto"><code>ng-if="points | filter:{tags:'Display'}"</code> Will not work and I'm sure there are plenty of errors</p>
</blockquote>
<p dir="auto">My apologies - I left this in with changing the page so much ...</p>
<blockquote>
<p dir="auto">As Mattfox sugested useing the watchlist builder to make your RQL queries.  Let me show you how.  The nice thing about using this method is there is you can see the results immediately on the query preview tab.</p>
</blockquote>
<p dir="auto">Thanks for that - I'm looking into how that all works ...</p>
<p dir="auto">Cheers</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22141</link><guid isPermaLink="true">https://forum.mango-os.com/post/22141</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Wed, 15 May 2019 06:17:51 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Tue, 14 May 2019 16:53:23 GMT]]></title><description><![CDATA[<p dir="auto">Hi Richard</p>
<p dir="auto">The promise variable will have 3 states fulfilled, rejected and pending.  It gives you the status of the query. So no is the answer to your question about the promise.</p>
<pre><code>&lt;ma-point-query query="'eq(tags.SiteName,SPS001)&amp;&amp;(tags.Display,Customer Load)'" points="points" &gt;&lt;/ma-point-query&gt;
</code></pre>
<p dir="auto">There is no operatore for your second criteria. This should work</p>
<pre><code>&lt;ma-point-query query="'eq(tags.SiteName,SPS001)&amp;eq(tags.Display,Customer Load)'" points="points" &gt;&lt;/ma-point-query&gt;
</code></pre>
<p dir="auto">As Mattfox sugested useing the watchlist builder to make your RQL queries.  Let me show you how.  The nice thing about using this method is there is you can see the results immediately on the query preview tab.<br />
<img src="https://camo.nodebb.org/1ca7a58904695a827b2176fbc0e264d82410d09f?url=https%3A%2F%2Fi.imgur.com%2FpiH3dD0.png" alt="0_1557821191387_untitled (25).png" class=" img-fluid img-markdown" /></p>
<p dir="auto">As for what you are doing in the table.  I think you might be running into scoping issues with using points. Hopefully, <a class="plugin-mentions-user plugin-mentions-a" href="/user/jared-wiltshire" aria-label="Profile: Jared-Wiltshire">@<bdi>Jared-Wiltshire</bdi></a>  can comment on that.</p>
<p dir="auto"><code>ng-if="points | filter:{tags:'Display'}"</code> Will not work and I'm sure there are plenty of errors in your browser's console when you use this.  tags is an object, what you are doing there is filtering the points array for any object that has a tag with a value of string 'Display'</p>
<p dir="auto">As in my previous post if you want to filter with tags you need to supply a nested object the filter ie:</p>
<pre><code>point="points | filter:{tags:{Display: 'Battery Capacity'} }"
</code></pre>
<p dir="auto">If you want to use it in a ng-if you need to use maFirst</p>
<pre><code>point="points | filter:{tags:{Display: 'Battery Capacity'} | maFirst}"
</code></pre>
<p dir="auto">Lastly, I think that your pages are getting quite complex and you would be better off creating a user module  where you have a controller to do all your logic and mapping of arrays,</p>
]]></description><link>https://forum.mango-os.com/post/22106</link><guid isPermaLink="true">https://forum.mango-os.com/post/22106</guid><dc:creator><![CDATA[CraigWeb]]></dc:creator><pubDate>Tue, 14 May 2019 16:53:23 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Tue, 14 May 2019 06:20:04 GMT]]></title><description><![CDATA[<p dir="auto">Unfortunately I'm still not getting the results I require; if I put the point query as:</p>
<pre><code>&lt;ma-point-query query="'eq(tags.SiteName,SPS001)&amp;&amp;(tags.Display,Customer Load)'" points="points" &gt;&lt;/ma-point-query&gt;
</code></pre>
<p dir="auto">I'm getting nothing back, but if I put:</p>
<pre><code>&lt;ma-point-query query="'eq(tags.SiteName,SPS001)'" points="points" &gt;&lt;/ma-point-query&gt;
</code></pre>
<p dir="auto">It only returns the tag <code>SiteName</code> and knocks out the tag <code>Display</code>, so I can't further filter on it...</p>
<p dir="auto">Also, when I did get this working (in a different capacity, using the <code>SIteName</code> tag to filter a specific site), the data populated in my <code>DIV</code>, but was destroyed almost instantaneously:</p>
<pre><code>&lt;tr ng-repeat="site in sites.sites"&gt;
    &lt;td&gt;
        &lt;ma-point-query query="'&amp;in(tags.SiteName,{{site.name}})'" points="points" &gt;&lt;/ma-point-query&gt;
        &lt;div style="color: white;background-color:black; border: 1px solid red;" ng-if="points | filter:{tags:'Display'}" &gt;&lt;pre&gt;{{points}}&lt;/pre&gt;&lt;/div&gt;
    &lt;/td&gt;
</code></pre>
<p dir="auto">Is this where the <code>promise</code> keyword becomes important?</p>
<p dir="auto">Cheers</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22103</link><guid isPermaLink="true">https://forum.mango-os.com/post/22103</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Tue, 14 May 2019 06:20:04 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Mon, 13 May 2019 08:24:17 GMT]]></title><description><![CDATA[<p dir="auto">Using the query builder as MattFox suggested is definitely a pro tip!</p>
<p dir="auto">Your question seems to be around where best to do the filtering.  IMO you will be better off doing one simple query to the backend and then doing all your filtering on the front end.  That is if your page is going to have a lot of different components using those points.  If the page is focused on only certain points then you could query for only those points.  The choice is yours</p>
<p dir="auto">The point query gives you an object with an array of points and all the points attributes,  it is not live updating. So now you know that in your page you only have points from SPS001, you can now filter down to the specific point you want in sps001 as such.  The syntax is like this because of the nested structure.</p>
<pre><code>&lt;ma-point-value point="points | filter:{tags:{Display: 'Battery Capacity'} }"&gt;&lt;/ma-point-value&gt;
</code></pre>
<p dir="auto">You can have multiple filters like such</p>
<pre><code>&lt;ma-point-value point="points | filter:{deviceName:'myDevice',tags:{Site: 'myTag'} }"&gt;&lt;/ma-point-value&gt;
</code></pre>
<p dir="auto">If you want to use an ng-repeat then you make your filter less precise that it gives multiple points that match the criteria.  You have a couple of options for the order that the ng-repeat will use.</p>
]]></description><link>https://forum.mango-os.com/post/22082</link><guid isPermaLink="true">https://forum.mango-os.com/post/22082</guid><dc:creator><![CDATA[CraigWeb]]></dc:creator><pubDate>Mon, 13 May 2019 08:24:17 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Mon, 13 May 2019 05:42:26 GMT]]></title><description><![CDATA[<p dir="auto">I can help you with the point query.<br />
You can either be specific at what you want at the beginning, or take a multitude of points then filter them accordingly with a filter or using <code>ng-if="point.tags.Display=='displayType'"</code></p>
<p dir="auto">For your point query, you can work from the watchlist builder to generate an RQL query.<br />
You'll get something like:</p>
<pre><code>&lt;ma-point-query query="'eq(deviceName,SPS001)&amp;in(tags.Display,Battery Capacity)'" points="points" promise="promise"&gt;&lt;/ma-point-query&gt;
</code></pre>
<p dir="auto">Hope that's of some help</p>
<p dir="auto">Fox</p>
]]></description><link>https://forum.mango-os.com/post/22080</link><guid isPermaLink="true">https://forum.mango-os.com/post/22080</guid><dc:creator><![CDATA[MattFox]]></dc:creator><pubDate>Mon, 13 May 2019 05:42:26 GMT</pubDate></item><item><title><![CDATA[Reply to maJsonStore (JSON store) on Mon, 13 May 2019 05:36:35 GMT]]></title><description><![CDATA[<p dir="auto">So, just trying to tie together Craig's example and Jared's example above, I'm getting confused how to filter by the tags; so far I have:</p>
<pre><code>&lt;ma-point-query query="{deviceName:'SPS001'}" points="points" promise="promise"&gt;&lt;/ma-point-query&gt;
&lt;!-- show me everything --&gt;
&lt;!--div style="color: white;background-color:black; border: 1px solid red;" ng-if="points" &gt;&lt;pre&gt;{{points}}&lt;/pre&gt;&lt;/div--&gt;
    
&lt;div md-progress="promise" style="border: 1px solid blue; background-color: white; color: black;" ng-repeat="point in points"&gt;
    &lt;span&gt;{{point.xid}}&lt;/span&gt;
    &lt;span style="background-color: yellow;"&gt;{{point.tags.Display}}&lt;/span&gt;
&lt;/div&gt;
</code></pre>
<p dir="auto">Which successfully shows me everything that matches the device name in the commented out (first) div, or the secondary DIV, which shows me the same points, but just the XID for the point and the tag for "Display" - but how do I get a specific point from the array if I want the "Display" equal to, say, "Battery Capacity" for this one site? I don't know if I need to put this filter within the <code>ma-point-query</code> section, or if I load the whole array into <code>points</code> and then filter in the <code>ng-repeat</code> section ... nor the syntax, as the <code>tags</code> seem to be at a secondary level of the initial query (as per the two <code>span</code>s, where one is <code>point.xid</code> and the tags are <code>point.tag.Display</code>).</p>
<p dir="auto">BTW: there is a typo on the page: /ui/docs/ng-mango/ma-point-query in the 'limit' description: "no limit by defualt"</p>
<p dir="auto">Thanks</p>
<p dir="auto">Richard</p>
]]></description><link>https://forum.mango-os.com/post/22079</link><guid isPermaLink="true">https://forum.mango-os.com/post/22079</guid><dc:creator><![CDATA[richard.mortimer]]></dc:creator><pubDate>Mon, 13 May 2019 05:36:35 GMT</pubDate></item></channel></rss>