• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    query on datapoint value

    Dashboard Designer & Custom AngularJS Pages
    2
    4
    1.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dgm
      last edited by dgm

      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'

      1 Reply Last reply Reply Quote 0
      • MattFoxM
        MattFox
        last edited by

        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

        Do not follow where the path may lead; go instead where there is no path.
        And leave a trail - Muriel Strode

        1 Reply Last reply Reply Quote 0
        • D
          dgm
          last edited by dgm

          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 78

          405 63 67 48 78
          405 63 67 48 78
          405 63 67 48 78
          405 63 67 48 78

          612 63 67 48 78
          612 63 67 48 78
          612 63 67 48 78
          612 63 67 48 78

          on 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

          1 Reply Last reply Reply Quote 0
          • MattFoxM
            MattFox
            last edited by MattFox

            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

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

            1 Reply Last reply Reply Quote 0
            • First post
              Last post