## make a list for report metadata
reports <- list(
FirstReport = list(
synopsis = "First example report",
fun = "fun1",
paramNames = c("organization", "topic", "outputFormat"),
paramValues = c(111111, "work", "html")
),
SecondReport = list(
synopsis = "Second example report",
fun = "fun2",
paramNames = c("organization", "topic", "outputFormat"),
paramValues = c(111111, "leisure", "pdf")
)
)
## make a list of organization names and numbers
orgs <- list(
OrgOne = 111111,
OrgTwo = 222222
)
## client user interface function
ui <- shiny::fluidPage(
shiny::sidebarLayout(
shiny::sidebarPanel(
autoReportFormatInput("test"),
autoReportOrgInput("test"),
autoReportInput("test")
),
shiny::mainPanel(
autoReportUI("test")
)
)
)
## server function
server <- function(input, output, session) {
org <- autoReportOrgServer("test", orgs)
format <- autoReportFormatServer("test")
# set reactive parameters overriding those in the reports list
paramNames <- shiny::reactive(c("organization", "outputFormat"))
paramValues <- shiny::reactive(c(org$value(), format()))
autoReportServer(
id = "test", registryName = "rapbase", type = "dispatchment",
org = org$value, paramNames = paramNames, paramValues = paramValues,
reports = reports, orgs = orgs, eligible = TRUE
)
}
# run the shiny app in an interactive environment
if (interactive()) {
shiny::shinyApp(ui, server)
}
Run the code above in your browser using DataLab