Hello, please i have a code snippet similar to below. I’m unable to get the data with the map function.
<JavaScript>
var Observable = require("FuseJS/Observable");
var Context = require("Modules/Context");
var bankNameRegion = Observable();
var tellerNumber = Observable();
var amount = Observable();
var errorMessage = Observable();
var transaction = this.Parameter;
var transactionId = transaction.map(function(x) {
console.log(x.TrnsID);
return x.TrnsID;
});
</JavaScript>
When i logged the the data using console.log(transaction); i got
.map returns a derived Observable, which means that it must be consumed for it to be calculated. Please read about Observables and see the Observable API to find out what “consumed” means in this context.
Thanks so much for your response. I’ve already gone through and did that again but can’t really get a way out of the retrieving the details. Is there any other way of get values out of a parameter outside map. Can’t i just use key to call for the value stored against the key.
Well, this part in Tutorial covers passing properties and receiving them. Please take the whole tutorial if you haven’t yet.
The link I shared before says, explicitly: A really important thing to understand about Observables is that they need at least one subscriber before they start propagating data. There are a few ways to subscribe to an Observable.. Subscribe to it then?
Currently, it is vital to understand how to work with Observables correctly. Please invest the time. We are also working on an alternative that would allow us to write simple, plain ES6 JavaScript (without Observables), but that is still some way out without an ETA.
Thanks Uldis for the life saving information. I now have a deeper understanding of Observables. I was able to make it work following the information you shared.