on 07-12-2017 7:19 PM
Let's say I'm making a call to a calculation view using XSJS and I need to make a call to that calc view several times. Currently I'm making the calls in series one after the other. Is there a way to make all the calls at once in parallel.
Sample code of what I'm trying to achieve:
function getSalesOrders(IP, DATE){
//var IP = "1852";
//var DATE = "201410";
var select_all_sales_orders_query = "SELECT * FROM
\"_SYS_BIC\".\"PATH_TO_CALCVIEW/CALCVIEW\"('PLACEHOLDER' =
('$$IP$$', '"+IP+"'), 'PLACEHOLDER' = ('$$DATE$$', '"+DATE+"'))";
var salesOrdersList = []; var connection = $.db.getConnection();
var statement = null; var resultSet = null; try{
statement = connection.prepareStatement(select_all_sales_orders_query);
resultSet = statement.executeQuery();
var salesOrderList = [];
while (resultSet.next()) {
salesOrder = {};
salesOrder.CAGE = resultSet.getString(1);
salesOrderList.push(salesOrder);}
}
return salesOrdersList;
}
function doGet() {
for(var i=0; i<inputs.length; i++){
getSalesOrders(inputs[i].IP, inputs[i].DATE);
}
}
//get data from table here as an array and assign it to inputs[] array
doGet();
Is there a way to replace the for loop with something that would make all those calls asynchronously? My guess is that XS doesn't allow that but I would like to confirm. I'm using XS classic by the way.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.