0

I have a reactive input in ShinyUI Tab1:

selectInput("SelectVar", choices = DropDownListForVar())

,where

DropDownListForVar()) = function (){
    sqlQuery = return ( Connection, "Select var from dbo.Variables")
} ## using RODBC library

In my shiny app, I am also updating the dbo.Variables table from a Tab2. The problem is that I cannot see the updated value in dbo.Variables from Tab1, unless I restart the app.

Any ideas?

L_TS
  • 1
  • 1

2 Answers2

0

It is hard to debug without a reproducible example. My guess is that you lack the reactive context for selectInput or data retrieval. Please make sure to update the dropdown using updateSelectInput and fetch the data with a reactive expression, both inside server. Additionally, to achieve this goal, you need to inform your Shiny App automatically when the database is updated, which could be hard to implement. I would suggest triggering queries with an action button or timer (reactiveTimer)

OzanStats
  • 2,756
  • 1
  • 13
  • 26
0

I used updateSelectInput in server.R:

updateSelectInput(session ,"SelectVar", choices = DropDownListForVar())

triggered after updating "SelectVar" and it worked fine.

In my case, understanding when the database is updated was easy, since there is only one user at a time adding records on button click. Thank you!

L_TS
  • 1
  • 1