Skip to content

Commit 451da70

Browse files
committed
List resources
1 parent def4855 commit 451da70

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

R/DSLiteServer.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ DSLiteServer <- R6::R6Class(
311311

312312
#' @description List the names of the tables that can be assigned.
313313
tableNames = function() {
314-
names(private$.tables)
314+
if (length(private$.tables)) {
315+
names(private$.tables)
316+
} else {
317+
vector(mode="character", length = 0)
318+
}
315319
},
316320

317321
#' @description Check a table exists.
@@ -322,7 +326,11 @@ DSLiteServer <- R6::R6Class(
322326

323327
#' @description List the names of the resources (\code{resourcer::Resource} objects) that can be assigned.
324328
resourceNames = function() {
325-
names(private$.resources)
329+
if (length(private$.resources)) {
330+
names(private$.resources)
331+
} else {
332+
vector(mode="character", length = 0)
333+
}
326334
},
327335

328336
#' @description Check a resource (\code{resourcer::Resource} object) exists.

inst/examples/datashield.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ dslite.server$config()
1717
data("logindata.dslite.cnsim")
1818
conns <- datashield.login(logindata.dslite.cnsim, assign=T, variables=c("GENDER","PM_BMI_CONTINUOUS"), id.name="ID")
1919

20+
# list all available tables
21+
datashield.tables(conns)
22+
23+
# list all available resources
24+
datashield.resources(conns)
25+
2026
# check assigned variables
2127
datashield.symbols(conns)
2228

0 commit comments

Comments
 (0)