```{r include=FALSE}
if (outputSlot != "SummaryTable") {
  stop("Not a table result")
}
all_res <- current_results[resp_vars == variable]
if (!chunk_error) {
  all_res <- all_res[(vapply(all_res, length, FUN.VALUE = integer(1)) > 0)]
}
have_a_result <- length(all_res) > 0
if (!have_a_result) {
  stop("No results here")
}
```
```{r results='asis', eval=have_a_result}
cat(sprintf(title, dQuote(variable)))
cat("\n")
```
```{r echo=FALSE, eval=have_a_result, results='asis'}
for (x in all_res) {
  if (length(attr(x, "message")) > 0) {
    for (m in attr(x, "message"))
      message(m)
  }
  if (length(attr(x, "warning")) > 0) {
    for (w in attr(x, "warning"))
      warning(w)
  }
  error_shown <- FALSE
  if (length(attr(x, "error")) > 0) {
    e <- attr(x, "error")[[1]]
    try(stop(e))
    error_shown <- TRUE
  }
  attr(x, "message") <- NULL
  attr(x, "warning") <- NULL
  attr(x, "error") <- NULL
  class(x) <- setdiff(class(x), 'dataquieR_result')
  if (is.data.frame(x[[outputSlot]]) && nrow(x[[outputSlot]]) > 0 && ncol(x[[outputSlot]]) > 0) {
    print( htmltools::tagList(DT::datatable(x[[outputSlot]], filter = "top",
                                            options = list(scrollCollapse = TRUE, scrollY = "75vh"))) )
  }
}
```
