Hello
I'm working on a small shiny app, and I'm trying to filter the data from the inputs from the slider range.However, the table doesn't change while the slider range has changed.How could I solve the problem?
Below is the UI.R code I've used:
library(shiny)
library(shinythemes)
shinyUI<-fluidPage(
theme = shinytheme("cerulean"),
titlePanel("Dashboard"),
sidebarLayout(
sidebarPanel(
sliderInput("INVEST","Invest Range:",min = 0,max = 20000,value = c(100,300)),width = 4
),
mainPanel(
tabsetPanel(type = "tabs", tabPanel("customers data", tableOutput("dataset1"))
)
)
))
Below is the SERVER.R code I've used:
library(shiny)
library(RODBC)#for data connection
conn <- odbcDriverConnect("driver={SQL Server};server=;database=;uid=;pwd=")
shinyServer<-function(input, output) {
output$dataset1 <- renderTable ({
conn <- odbcDriverConnect("driver={SQL Server};server=;database=;uid=;pwd=")
query <- "SELECT BRKNo,SEX,BIRTHDAY,LAST_DATE,[ADDRESS],TEL_H_1,INVEST,C_Type,WRNT_REG_DATE,WRNT_CNCL_DATE,APL_FLAG,datediff(year,BIRTHDAY,getdate()) AS age
FROM dbo.SCUST
WHERE dbo.SCUST.CustNo not in (select custNo FROM dbo.WCKEY) AND [ADDRESS] not like '%testing%' AND [ADDRESS] not like '%XX%'"
queried <- sqlQuery(channel = conn, query = query)
dataset1 = queried
test <- dataset1[input$INVEST[1]:input$INVEST[2],]
test},include.rownames=FALSE)
}