Hyperledger Composer: How to query using string?

0 votes

I have a structure defined like that:

concept Data
{
  o Double Temp
  o Double Hum
}

asset Reading identified by ReadingID
{
    o String ReadingID
    o String DeviceID
    o Integer Time
    o Data Data
}

In Composer, I can search for ReadingID without coding anything, because it is the "primary key" and this query is automatically defined.

Is there a way for querying using basic types, like a String?

Nov 9, 2018 in Blockchain by digger
• 27,620 points
29 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can try this:

query selectReading {
  description: "my query"
  statement:
      SELECT org.acme.biznet.Reading
          WHERE (DeviceID ==_$device_id)
}


return query('selectReading', {device_id: device} )
// return query('selectReading', {device_id: '1234567'} )
        .then(function (results) {


           for (var n = 0; n < results.length; n++) {
            // process array of results
           }
       });
answered Nov 9, 2018 by Omkar
• 65,850 points

Related Questions In Blockchain

+1 vote
1 answer
0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 27,620 points
225 views
0 votes
1 answer
+1 vote
1 answer

I am unable to change port of composer-rest-server. Please help!

Use full format for running a business ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
210 views
+1 vote
1 answer
0 votes
1 answer

Hyperledger composer: How to include relationship in custom query?

You are trying to use filter={"include":"resolve"} in Composer Query. ...READ MORE

answered Nov 16, 2018 in Blockchain by Omkar
• 65,850 points
243 views
0 votes
1 answer

How to get TimeStamps in Hyperledger Composer?

Here's an example that works with basic-sample-network network: asset SampleAsset ...READ MORE

answered Oct 26, 2018 in Blockchain by Omkar
• 65,850 points
126 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.