I have an application in Shiny R. On ui.R I read a Textinput, On global.R I process a query using sqldf().
How can I read a Textinput of ui.R in Global.R ?
ui.R
shinyUI(fluidPage(
#books <<- list("Descritores FOUSP" = "descritor"),
# Application title
titlePanel("CRAI"),
headerPanel(title="Pesquisa de Descritores"),
sidebarLayout(
sidebarPanel(
h5('Qual é o tema da sua pesquisa ?'),
textInput("descritor", "Digite um descritor",""),
submitButton('Pesquisar')
)
)
This textInput with name "descritor", I want to use in query on global.R
I tried this:
output$desc <- renderText({
paste(input$descritor)})
sql <- sprintf("SELECT * FROM csv WHERE Assuntos = '%s'", output$desc)
But I can´t to read "descritor" on global.R.
input/outputobjects defined in global. You need the server function for that. You can pass in parameters from your input to your global function but you can't read directly frominput. It would be better to have a more complete reproducible example that shows your server code as well. - MrFlick