Advertisement
Guest User

Untitled

a guest
Mar 4th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. library(shiny)
  2. library(RMySQL)
  3.  
  4. source("keys.R")
  5.  
  6. con <- dbConnect( MySQL(), user=login, password=pass, db=database, host=host)
  7. print(paste("Default:", groupId))
  8. res <- dbSendQuery(con, paste('SELECT user_id, user_name
  9. FROM info i , enrolment e
  10. where i.user_id = e.fk_user_id and e.fk_group_id = ', groupId))
  11. dataf <- dbFetch(res)
  12. lista <- as.list(setNames(dataf$user_id, dataf$user_name))
  13. dbClearResult(res)
  14. dbDisconnect(con)
  15.  
  16. ui <- fluidPage( column(3, checkboxGroupInput("users",
  17. label = h3("User IDs"),
  18. choices = lista,
  19. selected = dataf$user_id),
  20. verbatimTextOutput("value")
  21. ))
  22.  
  23. server <- function(input, output, session) {
  24. observe({
  25. groupId <- parseQueryString(session$clientData$url_search)
  26. if ( length(groupId) > 0) {
  27. print(paste("groupId:",groupId))
  28. }})
  29. }
  30.  
  31. shinyApp(ui = ui, server = server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement