title: R Shiny: Accessing input reactive from dynamic selectInput in multilayer reactive setup
body: <p>PROBLEM SYNOPSIS: I have a shiny app I am building where I am trying to support database calls that drive dynamic lists of choices for selectInputs and where that dynamic input drives what a ggvis plot shows.  The dynamic selectInput is not correctly selected and filtering the ggvis plot</p>
  
  <p>QUESTION: How can I support dynamic drop down lists while still ensuring my ggvis plot filters based on the chosen item?</p>
  
  <p>PROBLEM DETAIL: </p>
  
  <p>Within my Server.R file I have a reactive that grabs a slice of data from the database.  The get_chunk function is a call to NEO4J that I know works: </p>
  
  <pre><code>shinyServer( function(input, output, session) {
  
  CURRENT_CHUNK &lt;- reactive({
      #call NEO4J
      chunk &lt;- get_chunk(some_list = input$chunk)
      return(chunk)
  })
  </code></pre>
  
  <p>I also have a reactive that simply filters down the data based on the ui choices on the front end. The input$A value is the chosen value from a dynamically built dropdown list.  The filter_reactive is below.  NOTE: I've separated these two so I don't have to call the database all the time; only when I choose a different CHUNK.  The filter reactive looks like the following:</p>
  
  <pre><code>NO_DB_REACTIVE &lt;- reactive({
      #react to current_chunk and pull back a chunk.
      filter_down &lt;- CURRENT_CHUNK()
      #check for nulls
      if (!is.null(chunk)) {
          if (input$A != "All") {filter_down &lt;- filter_down %&gt;% filter(A == input$A)}
          return(filter_down)
      }
    return(filter_down)
  })
  </code></pre>
  
  <p>The input$A value is generated dynamically as follows within the server.R file:</p>
  
  <pre><code># reactively /dynamically generated the choices for the channel owners
  output$owner_choices &lt;- renderUI({ selectInput("A", "FOR Owner"
                                                 , as.list(c("All",unique(CURRENT_CHUNK()[,'owner'] )))
                                                 , "All") })
  </code></pre>
  
  <p>I also have a reactive that generates my GGVIS plot that looks like the following:</p>
  
  <pre><code>#All of the visualizations
  MY_VIS &lt;- reactive({
  
    # Lables for axes
    yvar_name &lt;- names(display_choices)[display_choices == input$yvar]
    xvar_name &lt;- names(cat_choices)[cat_choices == input$xvar]
  
    #retrieving 
    yvar &lt;- prop("y", as.symbol(input$yvar))
    xvar &lt;- prop("x", as.symbol(input$xvar))
  
    CURRENT_CHUNK %&gt;% 
      ggvis(x = xvar, y = yvar) %&gt;%
      layer_bars() %&gt;% 
      add_axis("x", title = xvar_name, properties = axis_props(labels = list(angle = 45, align = "left", fontSize = 10))) %&gt;%
      add_axis("y", title = yvar_name) %&gt;%
      set_options(width = 900, height = 300)
  })
  </code></pre>
  
  <p>I tried to slim this down as much as possible.  There is some dynamic choosing of axes there but you get the point.  Notice I currently call CURRENT CHUNK within the MY_VIS reactive.  And the end of the file has these:</p>
  
  <pre><code>output$table &lt;- renderDataTable({ NO_DB_REACTIVE() }) 
  MY_VIS %&gt;% bind_shiny("my_vis") 
  </code></pre>
  
  <ol>
  <li>When I filter items this way I get no errors.  My table filters on input$A changes and the vis does not; I want the vis to change based on what input$A is as well.</li>
  <li>I originally tried having MY_VIS depend on NO_DB_REACTIVE.  This fails as input$A is never generated. I guess because CURRENT_CHUNK never runs as it doesn't have to.  Notice the output$owner_choices is generated by reacting to CURRENT_CHUNK() not NO_DB_REACTIVE().  </li>
  </ol>
  
  <p>KEY QUESTION: How can I set this up so my input$A value is available when I  want to filter my ggvis plot?</p>