//not tested yet. //to use, add crfTecant/crfData.js to requiresScript and in the call-back, run init //will work with crfSetup as setup object var crfData={}; crfData.init= function(cb=null){ this.print('[crfData:init]'); let that=this; let action=function(){that.afterScripts(cb);}; LABKEY.requiresScript(["crfTecant/runQuery.js","crfTecant/variableList.js"],action); } crfData.afterScripts= function(cb=null){ if (cb) cb(); } crfData.setSetup= function(setup){ this.setup=setup; } crfData.getContainer= function(label){ return this.setup.getContainer(label); } crfData.print= function(msg){ console.log(msg); } //getters crfData.getSnapshotObject= function(){ if (!("dataQueriesSnapshot" in this)) this.dataQueriesSnapshot=new Object(); return this.dataQueriesSnapshot; } crfData.getQuerySnapshot= function(queryName){ //check whether queryName is in snapshotObject? return this.getSnapshotObject()[queryName]; } crfData.getLayoutObject= function(){ if (!("dataQueriesLayout" in this)) this.dataQueriesLayout=new Object(); return this.dataQueriesLayout; } crfData.getQueryLayout= function(queryName){ //check whether queryName is in snapshotObject? return this.getLayoutObject()[queryName]; } crfData.getLookupObject= function(){ if (!("lookup" in this)) this.lookup=new Object(); return this.lookup; } crfData.getLookup= function(queryName){ let x=this.getLookupObject(); if (queryName in x) return x[queryName]; return null; } crfData.getQueryList= function(){ if (!("queryList" in this)) this.queryList=new Object(); return this.queryList; } crfData.getRegistration= function(){ let regQueryPars=variableList.parseVariables(this.setup.getSettings('registrationQuery')); let query=regQueryPars['query']; return this.getQuerySnapshot(query).rows; } crfData.getRegistrationMap= function(value=null){ let rows=this.getRegistration(); let qMap=new Object(); let key='Key'; if (!value) value='participantStudyId'; for (let i=0;i