query on datapoint value
-
have been getting datapoints for my chart using this:
<ma-point-query query="{$and: true, deviceName:'unit#1_plc', name:'jobNumber'}" limit="9" points="points"></ma-point-query>
but im really wanting the datapoints when "jobNumber=certainValue"
can this be done?
what about on only two devices like: deviceName:'unit#1_plc' or 'unit#2_plc'
-
Change your query based upon the watchlist builder:
For your datapoints if the required number is selected:
<label>Select Job number:</label> <md-select ng-model="jobNumber"> <md-option value="0">0</md-option><md-option value="1">1</md-option></md-select> <ma-point-query ng-if="jobNumber==1" query="'eq(deviceName,unit#1_plc)&eq(name,1)&limit(9)'" points="points"></ma-point-values>
For two devices:
<ma-point-query query="'or(eq(deviceName,unit#1_plc),eq(deviceName,unit#2_plc))&limit(2)'" points="points"></ma-point-values>
You'll need to expand more on what you're trying to achieve to get the correct queries if I've missed something
Fox
-
I will try to expand on this:
I have changed jobNumber to batchNumber to help clarify
There are several plc's , each one at different site. Each has 5 datapoints that we want.
(4 sensors and 1 batchNumber)
Using a modbus datasource, we are retreiving and logging these once per sec into mango on office laptop.
Batch numbers are generated on site so the office has no idea which plc has which batches or when they were done.batch#, ch1, ch2, ch3, ch4
404 63 67 48 78
404 63 67 48 78405 63 67 48 78
405 63 67 48 78
405 63 67 48 78
405 63 67 48 78612 63 67 48 78
612 63 67 48 78
612 63 67 48 78
612 63 67 48 78on and on every second...
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.
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
We have a customized serialChart which views realtime very nicely, but its the historical data that im having trouble with.hence my request for a query that compares a datapoint value on the plc
-
I think before we go further, you need to modify your naming convention...
So you've got a system where techs are installing these systems, but there's no actual documentation on what's what??
Sounds like an impending cluster...
You're storing the batch number as a point value, as well as having four other points to hold sensor data, correct?
Sounds like you need something to parse the data either before or in mango otherwise you're forever going to be chasing your tail.If you need to parse values you're going to have to write a controller to read these values and sort them into groups.
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:
//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 ); } }
Fox