|
@@ -79,7 +79,9 @@ function afterPopulatingLists(config,formConfig,data){
|
|
|
let qconfig=new Object();
|
|
|
|
|
|
qconfig.schemaName="study";
|
|
|
- qconfig.queryName="Study";
|
|
|
+ qconfig.queryName="StudyProperties";
|
|
|
+ qconfig.columns="StudySponsor,StudyCoordinator,EudraCTNumber,RegulatoryNumber,SubjectColumnName"
|
|
|
+ //make sure SubjectColumnName is part of the view
|
|
|
qconfig.success=function(data){afterPopulatingStudyData(config,formConfig,data)};
|
|
|
LABKEY.Query.selectRows(qconfig);
|
|
|
}
|
|
@@ -89,6 +91,8 @@ function afterPopulatingStudyData(config,formConfig,data){
|
|
|
formConfig.studyData=data;
|
|
|
print(config,"afterPopulatingStudyData");
|
|
|
print(config,"Number of study data entries: "+formConfig.studyData.rows.length);
|
|
|
+ print(config,"ParticipantId: "+formConfig.studyData.rows[0].SubjectColumnName);
|
|
|
+
|
|
|
|
|
|
|
|
|
let qconfig=new Object();
|
|
@@ -249,7 +253,7 @@ function afterPopulatingEntries(config,formConfig,data){
|
|
|
for (let i=0;i<dataForms.rows.length; i++){
|
|
|
|
|
|
let formKey=dataForms.rows[i].Key;
|
|
|
- //print(config,"Key: "+formKey);
|
|
|
+ print(config,"Key["+i+"]: "+formKey);
|
|
|
|
|
|
//figure out master query name
|
|
|
let masterQuery="NONE";
|
|
@@ -306,6 +310,7 @@ function afterPopulatingEntries(config,formConfig,data){
|
|
|
let fp3=config.document.createElement("p");
|
|
|
fp3.id="pid"+id;
|
|
|
fp3.innerHTML="NONE";
|
|
|
+ print(config,'Setting participant id from query: '+masterQuery);
|
|
|
if (masterQuery!="NONE"){
|
|
|
let qconfig=new Object();
|
|
|
qconfig.schemaName='lists';
|
|
@@ -365,11 +370,17 @@ function setPatientId(config,formConfig,data,id){
|
|
|
if (data.rows.length==0) return;
|
|
|
|
|
|
let participantCode=data.rows[0].participantCode;
|
|
|
+ let participantField=formConfig.studyData.rows[0].SubjectColumnName;
|
|
|
+
|
|
|
+
|
|
|
+ print(config,'participantCode: '+participantCode);
|
|
|
+ print(config,'participantField: '+participantCode);
|
|
|
for (let i=0;i<formConfig.demographicData.rows.length;i++){
|
|
|
let entry=formConfig.demographicData.rows[i];
|
|
|
let key=entry.lsid;
|
|
|
+ print(config,'Comparing to: '+key);
|
|
|
if (key!=participantCode) continue;
|
|
|
- let participantId=entry[config.participantField];
|
|
|
+ let participantId=entry[participantField];
|
|
|
config.document.getElementById(id).innerHTML=participantId;
|
|
|
break;
|
|
|
}
|