Passing parameters with 'input$ID' and 'value'

Hi guys.

I need to pass a parameter using some input value, but it's not working. Like:

df <- dbGetQuery(
      connection_reportUser,
      query <- glue(
        "select 
        cod_aqa as AQA,
        from
        QT_QTS.PLA_ORDEM_PRODUCAO
        where cod_aqa = 'input$aqateste'
        ")
      )

That way, returns no data available in my DATABASE when my Input = 'VS53'.

But... when i do the same code using:

df <- dbGetQuery(
      connection_reportUser,
      query <- glue(
        "select 
        cod_aqa as AQA,
        from
        QT_QTS.PLA_ORDEM_PRODUCAO
        where cod_aqa = 'VS53'
        ")
      )

That way, the program can find and return a value from my DATABASE.

My Input is called with this syntax:

selectInput("aqateste", "Tipo de AQA:",
                  choices=list('VS53','VS24', "VS55")
                  )

My DATABASE is Oracle and i'm using the GLUE Package.
I tried with many differents ways, like '{as.character(input$aqateste)}, "input$aqateste", (input$aqateste)... but did not work.

Can someone help me to identify the problem?

You have to use '{input$aqateste}' and the glue command has to be inside a reactive function, check this example

library(shiny)
library(glue)

ui <- fluidPage(
    
    selectInput("aqateste", "Tipo de AQA:",
                choices=list('VS53','VS24', "VS55")
                ),
    
    tableOutput(outputId = "query")
)

server <- function(input, output) {
    output$query <- renderText({
        query <- glue(
            "select 
        cod_aqa as AQA,
        from
        QT_QTS.PLA_ORDEM_PRODUCAO
        where cod_aqa = '{input$aqateste}'
        ")
    })
}

shinyApp(ui = ui, server = server)
1 Like

Man of god! It works!
Very thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.