@@ -944,64 +944,58 @@ cat("selectdbtables\n")
944944 # Throw up warning, then have first table selection in level that threw error remain selected
945945 while (length(tables )> 1 )
946946 {
947- if (length(tables )== 2 && " FVS_Cases" %in% tables ) break
947+ # if(length(tables)==2 && "FVS_Cases" %in% tables) break
948948 if (length(tables )== 2 && (tables [1 ] == " CmpCompute" && tables [2 ] == " CmpSummary" )) break
949949 if (length(tables )== 2 && (tables [1 ] == " CmpCompute" && tables [2 ] == " CmpSummary_East" )) break
950950 if (length(tables )== 2 && (tables [1 ] == " CmpCompute" && tables [2 ] == " CmpSummary_Metric" )) break
951951 if (length(tables )== 2 && (tables [1 ] == " CmpCompute" && tables [2 ] == " CmpSummary2" )) break
952952 if (length(tables )== 2 && (tables [1 ] == " CmpCompute" && tables [2 ] == " CmpSummary2_East" )) break
953953 if (length(tables )== 2 && (tables [1 ] == " CmpCompute" && tables [2 ] == " CmpSummary2_Metric" )) break
954954 ' %notin%' = Negate(' %in%' )
955- if (any(tables %in% globals $ simLvl )) {
955+ if (any(tables %in% globals $ simLvl ) || (any( tables %in% globals $ simLvl ) && " FVS_Cases " %in% tables ) ) {
956956 session $ sendCustomMessage(type = " infomessage" ,
957957 message = paste0(" This composite table combination in not allowed" ))
958958 tables <- tables [1 ]
959- globals $ tableMessage = TRUE
960- updateSelectInput(session , " selectdbtables" , choices = as.list(globals $ tbsFinal ),
961- selected = tables )
959+ updateSelectInput(session , " selectdbtables" , selected = tables )
960+
962961 }
963- if (any(tables %in% globals $ stdLvl ) && any(tables %notin % globals $ stdLvl )) {
962+ selection = tables
963+ if (" FVS_Cases" %in% tables ) selection = tables [- which(tables == " FVS_Cases" )]
964+ if (any(tables %in% globals $ stdLvl ) && any(selection %notin % globals $ stdLvl )) {
964965 session $ sendCustomMessage(type = " infomessage" ,
965966 message = paste0(" Stand-level tables can only be combined with other stand-level tables" ))
966967 tables <- tables [1 ]
967- globals $ tableMessage = TRUE
968- updateSelectInput(session , " selectdbtables" , choices = as.list(globals $ tbsFinal ),
969- selected = tables )
968+ updateSelectInput(session , " selectdbtables" , selected = tables )
970969 }
971- if (any(tables %in% globals $ specLvl ) && any(tables %notin % globals $ specLvl )) {
970+ if (any(tables %in% globals $ specLvl ) && any(selection %notin % globals $ specLvl )) {
972971 session $ sendCustomMessage(type = " infomessage" ,
973972 message = paste0(" Species-level tables can only be combined with other species-level tables" ))
974973 tables <- tables [1 ]
975- globals $ tableMessage = TRUE
976- updateSelectInput(session , " selectdbtables" , choices = as.list(globals $ tbsFinal ),
977- selected = tables )
974+ updateSelectInput(session , " selectdbtables" , selected = tables )
978975 }
979976 # DBH-class tables cannot be combined with any other table
980- if (any(tables %in% globals $ dClsLvl )) {
977+ if (length( selection ) < 1 && any(selection %in% globals $ dClsLvl )) {
981978 session $ sendCustomMessage(type = " infomessage" ,
982979 message = paste0(" DBH-class tables cannot be combined with any other tables" ))
983980 tables <- tables [1 ]
984981 globals $ tableMessage = TRUE
985- updateSelectInput(session , " selectdbtables" , choices = as.list(globals $ tbsFinal ),
986- selected = tables )
982+ updateSelectInput(session , " selectdbtables" , selected = tables )
987983 }
988984 # HT-class tables cannot be combined with any other table
989- if (any(tables %in% globals $ htClsLvl )) {
985+ if (length( selection ) < 1 && any(selection %in% globals $ htClsLvl )) {
990986 session $ sendCustomMessage(type = " infomessage" ,
991987 message = paste0(" HT-class tables cannot be combined with any other tables" ))
992988 tables <- tables [1 ]
993989 globals $ tableMessage = TRUE
994- updateSelectInput(session , " selectdbtables" , choices = as.list(globals $ tbsFinal ),
995- selected = tables )
990+ updateSelectInput(session , " selectdbtables" , selected = tables )
996991 }
997992 # tree-level tables cannot be combined with any other table
998- if (any(tables %in% globals $ treeLvl )) {
993+ if (length( selection ) < 1 && any(selection %in% globals $ treeLvl )) {
999994 session $ sendCustomMessage(type = " infomessage" ,
1000995 message = paste0(" Tree-level tables cannot be combined with any other tables" ))
1001996 tables <- tables [1 ]
1002997 globals $ tableMessage = TRUE
1003- updateSelectInput(session , " selectdbtables" , choices = as.list(globals $ tbsFinal ),
1004- selected = tables )
998+ updateSelectInput(session , " selectdbtables" , selected = tables )
1005999 }
10061000 break
10071001 }
@@ -1496,7 +1490,7 @@ cat ("cmd=",cmd,"\n")
14961490 updateSelectInput(session , " plotType" ,selected = " scat" ) else
14971491 if (length(intersect(c(" StdStk" ," CmpStdStk" ," StdStk_East" ,
14981492 " CmpStdStk_East" ," StdStk_Metric" ," CmpStdStk_Metric" ),names(dat ))))
1499- updateSelectInput(session , " plotType" ,selected = " bar" ) else
1493+ updateSelectInput(session , " plotType" ,selected = " bar" ) else
15001494 updateSelectInput(session , " plotType" ,selected = " line" )
15011495 iprg = iprg + 1
15021496 setProgress(message = " Loading selection widgets" , detail = " " , value = iprg )
@@ -1512,7 +1506,7 @@ cat ("cmd=",cmd,"\n")
15121506 " StdStk" ," StdStk_East" ," StdStk_Metric" ," CmpStdStk" ," CmpStdStk_East" ,
15131507 " CmpStdStk_Metric" ),names(dat ))))
15141508 cho [isel ] else cho
1515- updateSelectInput(session , " year" , choices = as.list(cho ), selected = sel )
1509+ updateSelectInput(session , " year" , choices = as.list(cho ), selected = cho [ 1 ] )
15161510 }
15171511 globals $ exploreChoices $ year = cho
15181512 if (is.null(mdat $ Species ))
0 commit comments