Hi all,
I am working on a page which requires to send multiple time series requests at one time. However, as the requests are at promise (asynchronous) base. I cannot find a way to distinguish which result corresponds to its request when it is loaded and only result is returned (Without RIC). I wonder if there is a way to do that.
Thanks a lot for your help! I know it should have a trivial solution but i really have no idea how to fix this.
It would be helpful if you can build on the time series example.
//Create snapshot request via request() function.
function snapshot() {
var table = document.getElementById("myTable"); table.innerHTML='';
if (typeof sub !== 'undefined') {
sub.unsubscribe(); delete sub;
}
var intervalType = $("#select_intervalType").val();
var tsPromise = JET.Data.TimeSeries.request({"ric" : $("#RIC").val(),"view" : $("#VIEW").val(),"numberOfPoints": Number($("#numberOfPoints").val()),"timeZone" : "instrument","intervalType" : $("#select_intervalType").val(),"intervalLength" : 1}); tsPromise.then(resolve, reject);
}
function resolve(data){
var status = document.getElementById("status");
status.value = "Success";
data.....
}
//If request is rejected, then update status text area.
function reject(msg) {
var status = document.getElementById("status");
status.value = "Rejected: " + JSON.stringify(msg);
}