Reactvalues does not get updated for a nested if statmenets!!!

Hi Community Members!!

I have developed an R shiny App for ma company that uses some confidential data.My problem is that i have a reactValues data that get updated for some if statements and not for some others.More precisely ,the reacValues data get changed when changing Passoption or cleanMethod but not Dataversion.I mean here that in all cases the App is considering only the case when Dataversion()=="JA" even when Dataversion()=="Nein".

#Reactive data used for loading highest version of the measurements or not.
Dataversion<-reactive({input$highversion})
#Reactive data used for loading pass wafers or pass and fail wafers together
Passoption<-reactive({input$Pass})
#Reactive data used for choosing the preferred method for outliers removal.
cleanMethod <- reactive({input$Outliers})
#defining the data used for plots generation as reactiveValues
Par_plot_data <- reactiveValues(data = NULL)
observe({
#requiring needed data for data manipulation
req(Dataversion())
req(cleanMethod())
req(PlotData())
req(Passoption())
df <- PlotData()
if (cleanMethod() == "None") {
if (Passoption() == "Only Pass Wafers") {
if (Dataversion()== "Ja") {
mydt <- df[df$WAFER_PASS == "1", ] %>%
group_by(Wafer, Lot) %>%
filter(repeatCnt == max(repeatCnt)) %>%
ungroup()
}
else if(Dataversion()== "Nein") {
mydt <- df[df$WAFER_PASS == "1", ]
}
}
else if (Passoption() == "ALL") {
if (Dataversion()== "Ja") {
mydt <- df %>%
group_by(Wafer, Lot) %>%
filter(repeatCnt == max(repeatCnt)) %>%
ungroup()
}
else if(Dataversion()== "Nein") {
mydt <- df
}
}
}
else if (cleanMethod() == "Alpha*Sigma") {
# Applying the Alpha sigma method on the PlotData
newdf <- sapply(df, AlphaSigma)

  # Building a new data frame where the shorter columns will be extended by NAs
  mydx <- do.call(rbind, data.table::transpose(newdf))
  
  # Transforming to data frame
  mydx2 <- as.data.frame(mydx)
  
  # Assigning the right column names
  colnames(mydx2) <- names(newdf)
  
  dt <- unfactor(mydx2)
  
  dt[, 22:dim(dt)[2]] <- sapply(dt[, 22:dim(dt)[2]], as.numeric)
  dt[22:dim(dt)[2]] <- as.data.frame(dt[22:dim(dt)[2]])
  df <- dt
  if (Passoption() == "Only Pass Wafers") {
   
    if (Dataversion()== "Ja") {
      mydt <- df[df$WAFER_PASS == "1", ] %>%
        group_by(Wafer, Lot) %>%
        filter(repeatCnt == max(repeatCnt)) %>%
        ungroup()
    }
    else if(Dataversion()== "Nein") {
      mydt <- df[df$WAFER_PASS == "1", ]
    }
  } 
  else if (Passoption() == "ALL") {
    
    if (Dataversion()== "Ja") {
      mydt <- df %>%
        group_by(Wafer, Lot) %>%
        filter(repeatCnt == max(repeatCnt)) %>%
        ungroup()
    }
    else if(Dataversion()== "Nein") {
      mydt <- df
    }
  }
}
#return data for parameter scatter plot generation
Par_plot_data$data<-mydt

})

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.