@@ -78,28 +78,28 @@ private void possiblyResolveStudy(TableInfo table, @Nullable Map<String, Object>
7878
7979 private void possiblyResolveStudy (@ Nullable Map <String , Object > row , Container c , String sourceProperty )
8080 {
81- possiblyResolveStudyOrCohort (row , c , sourceProperty , "studyId" , "studyName" );
81+ possiblyResolveStudyOrCohort (StudiesSchema . TABLE_STUDIES , row , c , sourceProperty , "studyId" , "studyName" );
8282 }
8383
8484 private void possiblyResolveCohort (@ Nullable Map <String , Object > row , Container c , String sourceProperty )
8585 {
86- possiblyResolveStudyOrCohort (row , c , sourceProperty , "cohortId" , "cohortName" );
86+ possiblyResolveStudyOrCohort (StudiesSchema . TABLE_COHORTS , row , c , sourceProperty , "cohortId" , "cohortName" );
8787 }
8888
89- private void possiblyResolveStudyOrCohort (@ Nullable Map <String , Object > row , Container c , String sourceProperty , String targetFieldName , String filterFieldName )
89+ private void possiblyResolveStudyOrCohort (String tableToQuery , @ Nullable Map <String , Object > row , Container c , String sourceProperty , String targetFieldName , String filterFieldName )
9090 {
9191 if (row == null )
9292 {
9393 return ;
9494 }
9595
96- if (row .get (sourceProperty ) != null & row .get (sourceProperty ) instanceof String )
96+ if (row .get (sourceProperty ) != null & row .get (sourceProperty ) instanceof String & ! String . valueOf ( row . get ( sourceProperty )). isEmpty () )
9797 {
9898 if (!NumberUtils .isCreatable (row .get (sourceProperty ).toString ()))
9999 {
100100 Container target = c .isWorkbookOrTab () ? c .getParent () : c ;
101101 SimpleFilter filter = new SimpleFilter (FieldKey .fromString ("container" ), target .getEntityId ()).addCondition (FieldKey .fromString (filterFieldName ), row .get (sourceProperty ));
102- List <Integer > rowIds = new TableSelector (StudiesSchema .getInstance ().getSchema ().getTable (StudiesSchema . TABLE_COHORTS ), PageFlowUtil .set ("rowId" ), filter , null ).getArrayList (Integer .class );
102+ List <Integer > rowIds = new TableSelector (StudiesSchema .getInstance ().getSchema ().getTable (tableToQuery ), PageFlowUtil .set ("rowId" ), filter , null ).getArrayList (Integer .class );
103103 if (rowIds .size () == 1 )
104104 {
105105 row .put (targetFieldName , rowIds .get (0 ));
0 commit comments