Device Name Filter with Exact Name
-
Hi, I was trying to filter with query="{devicename:'PM1'}" and in the result point list I also get points from the devicename 'PM10'. How do I make the query for the exact device name?
-
Hi morris,
Try
query="'deviceName=PM1'"
orquery="'eq(deviceName,PM1)'"
-
@phildunlap said in Device Name Filter with Exact Name:
eq(deviceName,PM1)
Hi phildunlap, thanks for the response. I was using <ma-device-name-list> to filter a device name. My code is here
<div layout="row"> <md-input-container> <label>Device</label> <ma-device-name-list ng-model="selectedDevice" contains="'PM'" ng-init="selectedDevice='PM1'"></ma-device-name-list> </md-input-container> </div> <ma-point-query query="{deviceName:selectedDevice}" sort="'name'" points="points"></ma-point-query> <ma-get-point-value points="points"></ma-get-point-value> <ma-calc input="points | filter:{name:'ActiveEnergy '} | maFirst" output="energy"></ma-calc> <ma-calc input="points | filter:{name:'AverageCurrent'} | maFirst" output="current"></ma-calc> <ma-calc input="points | filter:{name:'AverageVoltage'} | maFirst" output="voltage"></ma-calc> <ma-calc input="points | filter:{name:'ActivePower'} | maFirst" output="power"></ma-calc> <ma-calc input="points | filter:{name:'PF'} | maFirst" output="powerFactor"></ma-calc> <ma-calc input="points | filter:{name:'ApparentPower'} | maFirst" output="demand"></ma-calc>
When the page is just loaded, it will list all datapoints regardless of ng-init value.
Also when a device is selected, says PM1, it will return all datapoints from both PM1 and PM10.I tried to put
query="'deviceName=selectedDevice'"
orquery="'eq(deviceName,selectedDevice)'"
it wont work.
when I tried
query="'deviceName=PM1'"
orquery="'eq(deviceName,PM1)'"
It is working for PM1. How can I make it work? -
Try
query="'deviceName=' + selectedDevice"
-
Thanks phildunlap, that solves both issues, including initial page loading.
-
Glad to hear it!
-
Hi phildunlap, may you have a look on my other post? pointquery from a watchlist by watchlistname and do calculation