Querying a specific parameter within json stored to a stream

+2 votes
Good Day,

If I've published a number of parameters to a stream in json format, e.g.

{"method":"publish","params":["Car logbook","REG1231",{"json":{"VIN":"7820D","Date":"01052019","Inspector":"JP211","Station":"OXFORD","Condition":"Satisfactory","Actions":"1A"}}],"chain_name":"nw-469-371-2"}

{"method":"publish","params":["Car logbook","REG9922",{"json":{"VIN":"1001D","Date":"01052019","Inspector":"JP211","Station":"CHARLIE","Condition":"Unsatisfactory","Actions":"2A"}}],"chain_name":"nw-469-371-2"}

{"method":"publish","params":["Car logbook","REG1231",{"json":{"VIN":"7820D","Date":"01052019","Inspector":"JP211","Station":"DELTA","Condition":"Satisfactory","Actions":"1B"}}],"chain_name":"nw-469-371-2"}

Is there a way for me to setup a query that just lists entries for VIN: 7820D ?

At present, I see that it is possible to list items by publisher and key. I'd like to present a web portal with a  function that allows me to search and filter results at a granular level, quickly.

Regards,

Zaid
asked May 1, 2019 by zaidmo

1 Answer

+1 vote

I'm afraid there's no such filter provided by the CLI. However, you can filter stream items through key(s) using liststreamkeyitems. So, you can make "VIN: 7820D" a key and then query it's items.

PS. There can be more than one key for a stream item.

Hope this helps.

Cheers

answered May 1, 2019 by mirabdulHaseeb
Okay great. Didn't know I could have multiple keys. Perhaps I then make all the searchable parameters keys.
Yes, That's the solution in my mind.

Happy to help.
...