1

I want to pass multiple parameters(for example array) using Hyperledger query language. like -

query selectClaimsByMultipleTransanctionID{
  description: "Select all claims based on TransactionID"
  statement:
      SELECT bbc.example.biznet
          WHERE (transactionId **in** _$transactionId)
}

But the "In" operator is not available. Can anyone suggest some other way??

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Raj_Shekhar
  • 166
  • 1
  • 7

2 Answers2

1

Yes - just use CONTAINS eg. you can do

SELECT ncb1.example.biznet.Claims WHERE (txnArrayValues CONTAINS ["nnn", "nnn", "nnnn"])

where txnArrayValues is String txnArrayValues[] in your model

See Query guide here -> https://hyperledger.github.io/composer/latest/reference/query-language

Paul O'Mahony
  • 6,740
  • 1
  • 10
  • 15
0

Using CONTAINS operator you can pass multiple parameters.

for example

Model File:

participant User identified by id {
  o String id
  o String[] hobbies
}

Query:

query Q6 {
    description: "Select all users based on given hobbies"
    statement:
        SELECT ***.User
            WHERE (hobbies CONTAINS ['driving', 'swimming','...']
}
Isha Padalia
  • 877
  • 7
  • 24