0

I'm using an IBM-Blockchain platform VS code extension for one of my POC development. I want pagination on the Query function in fabric. Here is my demo example:

let queryString = 
  { 
    "selector": {
      "isLink": isLink,
      "f_id":f_id
    }
  }

How can I put pagination (like when 5 data comes on the first page and then continue like another page) on this chaincode selector query which is created on the IBM-Blockchain platform? Can anyone help me?

Thanks.

Isha Padalia
  • 877
  • 7
  • 24

1 Answers1

0

pagination is done using a pagination api, so suggest you take a look here https://hyperledger.github.io/fabric-chaincode-node/release-1.4/api/fabric-shim.ChaincodeStub.html#getQueryResultWithPagination__anchor For the api reference. Sorry I don't know if there is any example of use of this in any of the fabric samples, if not then hopefully there are some examples in the test suite for fabric-chaincode-node on github.

david_k
  • 5,843
  • 2
  • 9
  • 16
  • David Thanks for your answer, Already, I had gone through with this article. But I'm looking for an example or any repo. – Isha Padalia Apr 09 '20 at 13:04
  • Hii David, Can I get the previous bookmark on query output? I used this method but I get only next Bookmark reference! How I get the previous reference bookmark in Query? – Isha Padalia Apr 10 '20 at 07:02
  • I've not used pagination myself. Maybe you can cache your bookmarks as you paginate through, then use a previous bookmark to go backwards ? – david_k Apr 13 '20 at 08:03