I am working on hyperledger fabric.I want to access the \'eventEmitted\' field in transaction history of hyperledger fabric.
/*transaction history*/
\"transac
something like: (this is based on the trade-network
as a sample from our sample-networks on Github:
return query('History') // eg. just a standard Historian query where emittedEvents are recorded
.then(function (results) {
for (var n = 0; n < results.length; n++) {
var element = results[n];
if (element.eventsEmitted[0] == 'Resource {id=org.acme.trading.TradeNotification#ee730e99-ba77-48b4-83a1-480e7218b7ff#0}') {
console.log('Historical record # ' + (n+1) + ', object is : ' + element);
console.log('eventEmitted: ' + element.eventsEmitted[0]);
var firsteventElement = element.eventsEmitted[0];
console.log('New var is ' + firsteventElement);
var fieldVal = element.eventsEmitted[0].commodity; // field defined in my Event in the model
console.log('New var is ' + firsteventElement + 'commodity id in the event Emitted is ' + fieldVal);
}
} /// for
});
I do not know CONTAINS is not the answer you want? But you can give it a try