0

What i want to achieve that user can flexiblely disable/enable 2nd level filters id2('Resource') and id3('Case'):

  1. id2('Resource') and id3('Case') enabled: program show relevant result based on id1, id2 and id3 filters
  2. id2('Resource') and id3('Case') disabled: program ONLY show level 1 id1('ThrouputTime') filtered result.

I implement (pheusdo) code below, the program will fetch result based on these 3 filtered at SAMETIME, but can not achieve 2nd situation mentioned above. Any suggestion?

ui <- dashboardPage(
    dashboardBody(
        tabItems(
                tabItem(tabName = "dashboard",
            fluidRow(
                        box(
                            title = "ThrouputTime",
                            width = 3,
                            sliderInput(inputId="id1", label="ThrouputTime", ...)
                           )    
                ),      
            fluidRow(
                        box(
                            title = "Resource",
                            width = 3,
                            selectInput(inputId="id2", label="resource", ...)
                           ),
                box(
                            title = "Case",
                            width = 3,
                            selectInput(inputId="id3", label="case", ...)
                           )
                )
            )
              )
           )



server <- function(input, output, session){

  observe({
    output$process <- renderProcessanimater(expr = {

      filtered_event <- newevent %>%
        filter_throughput_time(interval = c(input$throughput[1], input$throughput[2])) %>%
        filter_resource(input$id2)  %>%                 
        filter_case(input$id3, reverse = F)                   

        #.... generate a workflow graph based on 'filtered_event' from above    
    })
  })
}

graph <- shinyApp(ui, server)
runApp(graph, host = "0.0.0.0", port = 5050)
Jassen
  • 13
  • 5
  • (1) I think your logic for `id2 and id3` versus `neither id3 nor id3` is incomplete, what happens if `id2 but not id3` and vice versa? (2) Your code is both incomplete and producing errors. Please make your question reproducible. This include the rest of the sample code (including listing non-base R packages) and sample data (e.g., `dput(head(x))`) if necessary (`mtcars` or similar if not). Refs: https://stackoverflow.com/questions/5963269, https://stackoverflow.com/help/mcve, and https://stackoverflow.com/tags/r/info. I suggest you simplify to `renderTable` or similar for demonstration. – r2evans Mar 01 '19 at 08:00
  • @r2evans, due to security reason, i cannot show real code, so the shown code is similar to pheusdo code – Jassen Mar 01 '19 at 08:25
  • Jassen, I understand about proprietary/confidential stuff. But you missed the real point: your code here is broken. You are (at least) missing a parenthesis. You have not informed us of pertinent packages (I'm inferring `shinydashboard`, but I don't have `renderProcessanimater` and don't really want to have to hunt around for things that should be easy for you to inform). And the best way for me to help you learn *a concept* (regardless of how proprietary your stuff may be) is for me to try code on my console. Since this is incomplete, that is not happening. – r2evans Mar 01 '19 at 20:54
  • A trend of quickly-and-thoroughly-answered questions on SO is that they are *reproducible* and *complete* with "just enough code/data" to present the problem and request help. Questions that either fail or just take too long are those that: make us guess at data; make us guess at missing or wrong code/components (that are not "the question"); and in general make us work hard just to come close to seeing what you're doing. Some refs for good questions: https://stackoverflow.com/questions/5963269, https://stackoverflow.com/help/mcve, and https://stackoverflow.com/tags/r/info. Good luck. – r2evans Mar 01 '19 at 20:56

0 Answers0