r - How to pass input parameters to SQL query in Shiny -


when select empno input, should pass select query.

using below, running select * emp how can run select * emp empno = xxxx

in server.r want run select * emp empno = (user selected empno)

ui.r :

shinyui(bootstrappage(   title="reactive-bootstrap",responsive=true,theme=null,   titlepanel=h5("employee report - reactive"),    sidebarlayout(     sidebarpanel(       selectinput(inputid="select",label="select employee",                   choices=c(7369,7499,7521,7566),selected=7369)),      mainpanel(tableoutput("dis"))))) 

server.r :

library(rodbc) channel<-odbcconnect("shiny",uid="scott",pwd="tiger") shinyserver(function(input,output){   sql<-sqlquery(channel,"select * emp")   output$dis<-rendertable(print(sql)) }) 

lets dropdown menu id empno try this..

qry = paste0('select * emp empno ="',input$empno,'"') sql<-sqlquery(channel,qry) output$dis<-rendertable(print(sql)) 

p.s. assume input$empno linked ids in table. if not set when populate dropdown menu...


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -