D'une Requête SQL A DataTable; R shiny
Salut à tous, je résalise une application R shiny mais je trouve des difficultés à coder.
J'utilise une Base de données Oracle et la table que j'utilise est CLIENT(ID_CLIENT, NAME_CLIENT, INFO_CLIENT, DATE_CLIENT)
Je voudrais avoir toutes les informations du client à partir de req22() qui utilise une fonction réactive et afficher tout dans tableau de type DataTable
Malheureusement j'ai cette erreur ci : Error in &&: type 'x' incorrect dans 'x && y'
Apparemment l'erreur est ici renderDataTable(req22(),options(DT.options =list(pageLength=5 ))) , je ne sais pas bien comment écrire req22.
Pourriez-vous m'aider s'i vous plait ? Je vous remercie d'avance. Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
library(DBI)
library(ROracle)
library(DT)
library(shinydashboard)
header <- dashboardHeader()
sidebar <- dashboardSidebar()
body <- dashboardBody(
DT::dataTableOutput('tableId'))
shinyApp(
ui = dashboardPage(skin = "blue", header, sidebar, body),
server = function(input, output, session= open()) {
drv <- dbDriver("Oracle")
host <- "host"
port <- port
svc <- "svc"
connect.string <- paste(
"(DESCRIPTION=", "(ADDRESS=(PROTOCOL=tcp)(HOST=", host, ")(PORT=", port, "))",
"(CONNECT_DATA=(SERVICE_NAME=", svc, ")))", sep = "")
DB <- dbConnect(drv, username = "username", password = "password", dbname = connect.string)
req22 <- reactive({
a = dbGetQuery(DB, "SELECT ID_CLIENT, NAME_CLIENT, INFO_CLIENT, DATE_CLIENT FROM CLIENT")
})
output$tableId = renderDataTable(req22(),options(DT.options =list(pageLength=5 )))
}) |