• 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

    Sql Queries/Sql Datapoint Confusion

    User help
    3
    4
    1.6k
    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.
    • A
      avilla
      last edited by avilla

      I'm storing test files in the jsondata table in the H2 database. Each test file gets its own row. I need a way, from javascript, to query the table for a specific test (row) so I can extract data from the "Data" Column. I understand that you can input the xid into the ma-json-store directive, but this won't work for me because the filenames can't be hardcoded. I'm not sure how to do this and I've been trying/looking at all of the docs for a few days now. An example of what my jsondata table looks like is:

      JSONDATA
      0_1510623920129_jsondata.JPG

      I'm able to insert and extract data from the row with the name "filename". For instance I can add to and get filenames from the jsonobject under the "DATA" Column. However, once I retrieve the filename from code, I don't know how to use it to get the corresponding row's data. An sql query to do what I want would be:
      select data from jsondata where name='<name of desired file>' . But I can't figure out how to achieve this using sql_datapoints/datasources/the ma-json-store directive. Thanks for your help.

      1 Reply Last reply Reply Quote 0
      • Jared WiltshireJ
        Jared Wiltshire
        last edited by

        OK I guess the big question is where are you trying to extract this data to? Are you trying to display this on a custom page or something?

        select data from jsondata where name='<name of desired file>'
        The direct analog of this SQL you provided for a dashboard is <ma-json-store xid="name of desired file" item="myItem" value="data"></ma-json-store>

        Developer at Radix IoT

        A 1 Reply Last reply Reply Quote 0
        • A
          avilla @Jared Wiltshire
          last edited by

          @jared-wiltshire Yes a custom page. I'm using the loginPageTemplate. I don't think using the ma-json-store directive as you wrote it will work because then the filename is still hardcoded. Unless there's a way to pass a variable to the xid attribute? Sorry I'm not experienced with html/javascript. I've tried that exact code, but it doesn't seem to work with a variable passed in. The only other way I can think of doing it is putting all my data in the same row.

          1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by phildunlap

            Hi avilla,

            Are you putting your variable name into {{ }} to evaluate it?

            This works for me,

            <ma-calc input='"mangoUI-menu"' output="output"></ma-calc>
            <ma-json-store xid="{{output}}" item="myItem" value="data">{{myItem}}</ma-json-store>
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post