Shiny app r Programming

ui <- fluidPage(

   # Application title

   # Sidebar with a slider input for number of bins 
                    label = "Choose a Station-id",
                    choices = list("ALNMRGA1"='a', "COOKOLV1"='b', "COOKOLV3"='c',"DRSS1ST1"='c',"GSHTEM1"='d',"GSWSILM"='e',"GSCFTY1"='f',"GSD5531"='g',"GSHASET"='h',"GSHTEM2"='i',"GSNPRM1"='j',"GSOAKSK1"='k',"ROSSLEX1"='l',"OR_Ln60_1"='n',"COOKOLV2"='o'),
                    selected = "ALNMRGA1"),
                    label = "Choose a Attribute",
                    choices = c("Temperature" = "a1",
                                "windspeed" = "a2",
                    selected = "DLR_value"),
                       label = 'Date range input: yyyy-mm-dd',
                       start = Sys.Date() - 2, end = Sys.Date() + 2
                    "Number of bins:",
                    min = 1,
                    max = 50,
                    value = 30),
      submitButton("Submit") ),
       # Show a plot of the generated distribution

# Define server logic required to draw a histogram
server <- function(input, output,session) {
  output$dateText<- renderPlot({
    conn <-dbConnect(odbc(),
                     Driver="SQL Server",
                     Server ="abc",
                     Database = "test")
      x<-dbGetQuery(conn, paste0("SELECT top 100 temperature FROM tblWeatherGWC WHERE validDateTime >='",input$dateRange[1]," 00:00:00.000'" ,"AND validDateTime <= '",input$dateRange[2]," 00:00:00.000' and stationId='ALNMRGA-1'"))
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    hist(x$temperature ,col = 'red', border = 'white',breaks = bins)
  }} ) }

# Run the application 
shinyApp(ui = ui, server = server)

I want that my code to directly take values of station_id from the database and all the other attributes from the database instead of describing them and writing them in the slider menu. I want the input and display data according to that.

Hi! Welcome to RStudio Community!

It looks like your code was not formatted correctly to make it easy to read for people trying to help you. Formatting code allows for people to more easily identify where issues may be occuring, and makes it easier to read, in general. I have edited you post to format the code properly.

In the future please put code that is inline (such as a function name, like mutate or filter) inside of backticks (`mutate`) and chunks of code (including error messages and code copied from the console) can be put between sets of three backticks:

example <- foo %>%
  filter(a == 1)

This process can be done automatically by highlighting your code, either inline or in a chunk, and clicking the </> button on the toolbar of the reply window!

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code

In addition, I am not sure that it is entirely clear what you are looking for... It looks like you SQL query should be correct (i.e. no clear syntax error that I can see) but without access to the database or any idea of what the data looks like, it is hard to tell you much more.

Also, what do you mean you want to take values from the database and not write them in the slider menu? The only slider input I see is for the number of histogram bins and that seems, to me, like something that you would want as a user input, rather than something stored in a database