|
@@ -0,0 +1,84 @@
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function makeQuery(targetObject,containerName,queryName,fieldName,filterArray){
|
|
|
+
|
|
|
+ let e=new Object();
|
|
|
+ e.containerName=containerName;
|
|
|
+ e.queryName=queryName;
|
|
|
+ e.fieldName=fieldName;
|
|
|
+ e.filterArray=filterArray;
|
|
|
+ e.targetObject=targetObject;
|
|
|
+ return e;
|
|
|
+}
|
|
|
+
|
|
|
+function getDataFromQueries(queryArray,cb){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ afterQuery(new Object(),-1,queryArray,cb);
|
|
|
+}
|
|
|
+
|
|
|
+function afterQuery(data,id,queryArray,cb){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (id>-1){
|
|
|
+ let e1=queryArray[id];
|
|
|
+ let fieldName=e1.fieldName;
|
|
|
+ e1.targetObject.print('afterQuery['+fieldName+']: '+data.rows.length);
|
|
|
+ e1.targetObject[fieldName]=data;
|
|
|
+ }
|
|
|
+ id+=1;
|
|
|
+ if (id==queryArray.length) {
|
|
|
+ cb();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ let e=queryArray[id];
|
|
|
+ let qconfig=new Object();
|
|
|
+ qconfig.containerPath=e.targetObject.getContainer(e.containerName);
|
|
|
+ qconfig.schemaName="lists";
|
|
|
+ if ("schemaName" in e){
|
|
|
+ e.targetObject.print('afterQuery: schemaName='+e.schemaName);
|
|
|
+ qconfig.schemaName=e.schemaName;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("columns" in e){
|
|
|
+ e.targetObject.print('afterQuery: columns='+e.columns);
|
|
|
+ qconfig.columns=e.columns;
|
|
|
+ }
|
|
|
+ qconfig.queryName=e.queryName;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ("filterArray" in e)
|
|
|
+ qconfig.filterArray=e.filterArray;
|
|
|
+
|
|
|
+
|
|
|
+ qconfig.success=function(data){afterQuery(data,id,queryArray,cb);};
|
|
|
+ qconfig.failure=function(errorInfo,responseObj){onFailure(e.targetObject,errorInfo,responseObj);};
|
|
|
+ LABKEY.Query.selectRows(qconfig);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+function onFailure(targetObj, errorInfo, responseObj){
|
|
|
+
|
|
|
+ targetObj.print('[afterQuery]: Failure: '+errorInfo.exception);
|
|
|
+
|
|
|
+}
|
|
|
+
|