Chandan Chanda
Chandan Chanda

Reputation: 153

can i write complex queries in hyperledger composer

I have to retrieve particular attribute from an asset like select name from employeetable.is it possible to fetch particular attribute in hyperledger composer

Upvotes: 2

Views: 275

Answers (2)

peara
peara

Reputation: 11

In composer rest server, you can use API with filter fields. Such as {"fields": ["name", "description"]"} It will return only those fields instead of full objects.

Reference: https://hyperledger.github.io/composer/latest/business-network/query It said only where is currently support, but fields can be used as well.

Upvotes: 0

MrL
MrL

Reputation: 1720

Yes, here the official documentation

https://hyperledger.github.io/composer/unstable/reference/query-language

And the specific example

query findEmployee{
    description: "Select employee based on the name"
    statement:
        SELECT org.example.Employee
            WHERE (firstName == _$nameParam)
}

Upvotes: 1

Related Questions