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
• 26,740 points
560 views

1 answer to this question.

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
• 69,220 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
• 26,740 points
2,433 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,370 points
896 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
+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
1,125 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
• 69,220 points
1,105 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
• 69,220 points
1,338 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP