Сначала я ищу некоторые значения в БАЗА ДАННЫХ , используя этот код:
observeEvent(input$pesquisa,{
query <- glue(
"select
cod_ordem_producao as ORDEM,
dim_ext_tubo as DIAMETRO,
esp_par_tubo as PAREDE,
cod_aqa as AQA,
tmo_ciclo_plan as CICLO,
dsc_aco as GRAU,
from
QT_QTS.PLA_ORDEM_PRODUCAO
where DIM_EXT_TUBO = {as.numeric(input$diametro)}
and esp_par_tubo = {as.numeric(input$parede)}
order by DTH_CRIACAO_REG desc")
df <- dbGetQuery(
connection_reportUser,
query
)
df
Я хочу обновить DF после того, как пользователь введет новуюзначение Input, вызываемое в наблюдатьEvent с insertUI , например: (продолжение кода)
observeEvent(input$pesquisa, {
insertUI(
selector = "#pesquisa",
where = "afterEnd",
ui = selectInput(
"grau",
label = "Grau:",
choices = df$GRAU
)
)
})
observeEvent(input$buscaaqa, {
insertUI(
selector = "#buscaaqa",
where = "afterEnd",
ui = selectInput(
"aqa",
label = "AQA:",
choices = df$AQA
)
)
})
observeEvent(input$buscaciclo, {
insertUI(
selector = "#buscaciclo",
where = "afterEnd",
ui = selectInput(
"aqa",
label = "Ciclo:",
choices = df$CICLO
)
)
})
Как мне обновить DF с каждой записью пользователя?
Я пытался с req () , но это просто не работает.Я попытался:
observeEvent(input$pesquisa, {
insertUI(
selector = "#pesquisa",
where = "afterEnd",
ui = selectInput(
"grau",
label = "Grau:",
choices = df$GRAU
)
)
})
observeEvent(input$buscaaqa, {
{req(input$grau)
query <- glue(
"select
cod_aqa as AQA,
from
QT_QTS.PLA_ORDEM_PRODUCAO
where dsc_aco = {as.character(input$grau)}")
df <- dbGetQuery(
connection_reportUser,
query
)
df
}
insertUI(
selector = "#buscaaqa",
where = "afterEnd",
ui = selectInput(
"aqa",
label = "AQA:",
choices = df$AQA
)
)
})
observeEvent(input$buscaciclo, {
{req(input$aqa)
query <- glue(
"select
AQA,
from
QT_QTS.PLA_ORDEM_PRODUCAO
where grau = {as.character(input$grau)}")
df <- dbGetQuery(
connection_reportUser,
query
)
df
}
insertUI(
selector = "#buscaciclo",
where = "afterEnd",
ui = selectInput(
"aqa",
label = "Ciclo:",
choices = df$CICLO
)
)
})
В этом случае ... я наблюдаю событие, ожидающее предыдущего ввода, а затем нахожу в базе данных (по крайней мере, это может быть идеей).Но это вызывает ошибку, из-за которой я не могу определить, где находится ошибка.
Без req () (мое действительное состояние) значения поступают с первого поиска с первогоinput.
Кто-нибудь знает какой-нибудь метод для решения этой проблемы?Используя req () или используя другой источник.