...Hi Good day , I have a problem that I cannot seem to find a solution, have tried resintalling R and its libraries with no luck so far.
Have the app split into ui.R and server.R ,it runs locally but when I try to run it on server it throws this error Error in force(ui) : object 'ui' not found.
heres my code
ui.R
library(shiny)
library(shinythemes)
library(shinydashboard)
library(ggplot2)
library(mlutils)
dbHeader <- dashboardHeader()
dbHeader$children[[2]] <- tags$img(src='header.jpg',height='43',width='1899')
ui<-dashboardPage(
dbHeader,
dashboardSidebar(
textInput("Tienda","Tienda"),
textInput("depto","depto"),
textInput("Articulo","Articulo"),
actionButton("mybutton","Consultar Tienda")
),
dashboardBody(
fluidRow(
{ column(4,wellPanel(style = "background-color: #3366ff;",
{fluidRow(column(5,
h3("N? Item:",style = "color:#ffffff;"),
h5("Desc:", style = "color:#ffffff;"),
br(),
h5("Proveedor:", style = "color:#ffffff;"),
h5("N? Proveedor:", style = "color:#ffffff;"),
br(),
h5("Depto.:", style = "color:#ffffff;"),
h5("Categoria:", style = "color:#ffffff;"),
h5("Effective Date:", style = "color:#ffffff;"),
br(),
br(),
h5("CEDIS:", style = "color:#ffffff;")
),
column(6,
h3(textOutput("Item"),style = "color:#ffffff;"),
h5(textOutput("Desc"), style = "color:#ffffff;"),
br(),
h5(textOutput("Proveedor"), style = "color:#ffffff;"),
h5(textOutput("NoProv"), style = "color:#ffffff;"),
br(),
h5(textOutput("Depto"), style = "color:#ffffff;"),
h5(textOutput("Categoria"), style = "color:#ffffff;"),
h5(textOutput("EffectiveDate"), style = "color:#ffffff;"),
br(),
br(),
h5(textOutput("ProcessChannelType"), style = "color:#ffffff;"),
h5(textOutput("Cedis"), style = "color:#ffffff;")
))},
{fluidRow(column(3,
h5("Vndr Pack:", style = "color:#ffffff;"),
h5("Item Type:", style = "color:#ffffff;"),
h5("Order Book:", style = "color:#ffffff;"),
h5("Carry Option:", style = "color:#ffffff;")),
column(3,h5(textOutput("VndrPack"), style = "color:#ffffff;"),
h5(textOutput("ItemType"), style = "color:#ffffff;"),
h5(textOutput("OrderBook"), style = "color:#ffffff;"),
h5(textOutput("CarryOption"), style = "color:#ffffff;")),
column(3,h5("Whse Pack:", style = "color:#ffffff;"),
h5("Status Code:", style = "color:#ffffff;"),
h5("CWO:", style = "color:#ffffff;"),
h5("Carried Status:", style = "color:#ffffff;")),
column(3,h5(textOutput("WhsePack"), style = "color:#ffffff;"),
h5(textOutput("StatusCode"), style = "color:#ffffff;"),
h5(textOutput("CW"), style = "color:#ffffff;"),
h5(textOutput("CarriedStatus"), style = "color:#ffffff;"))
)}
))},
{column(3,wellPanel(style = "background-color: #3399ff;",
{fluidRow(column(4,
h5("Prom.Vta Wkly:", style = "color:#ffffff;"),
hr(),
h5("Prom.Fcst.Wkly:", style = "color:#ffffff;"),
hr(),
h5("Prom.Ships.Wkly:", style = "color:#ffffff;"),
br()),
column(3,
h5(textOutput("PromVtaWkly"), style = "color:#ffffff;"),
br(),
h5(textOutput("PromFcstWkly"), style = "color:#ffffff;"),
br(),
h5(textOutput("PromShipsWkly"), style = "color:#ffffff;")
))}))},
{column(4,wellPanel(style = "background-color: #0066ff;",
{fluidRow(column(4,
h5("On Hand:", style = "color:#ffffff;"),
h5("In transit:", style = "color:#ffffff;"),
h5("In Warehouse:", style = "color:#ffffff;"),
h5("On Order:", style = "color:#ffffff;"),
h5("Total:", style = "color:#ffffff;"),
h5("Stock Outs:", style = "color:#ffffff;"),
h5("Ajustes IP:", style = "color:#ffffff;")
),
column(1,
h5(textOutput("OnHand"), style = "color:#ffffff;"),
h5(textOutput("Intransit"), style = "color:#ffffff;"),
h5(textOutput("InWarehouse"), style = "color:#ffffff;"),
h5(textOutput("OnOrder"), style = "color:#ffffff;"),
h5(textOutput("Total"), style = "color:#ffffff;"),
h5(textOutput("StockOuts"), style = "color:#ffffff;"),
h5(textOutput("AjustesIP"), style = "color:#ffffff;")
))}))}
)))
server.R:
library(shiny)
library(shinythemes)
library(shinydashboard)
library(ggplot2)
library(mlutils)
my_sql <- readLines('Qry_AppTienda_2019_.sql')
my_sql <- trimws(my_sql)
my_sql <- grep('^--', my_sql, invert = TRUE, value = TRUE)
my_sql <- paste(my_sql, collapse = '\n')
server<-function(input,output,session){
values <- reactiveValues(mydata = NULL)
observeEvent(input$mybutton,{
withProgress({
setProgress(message = "Procesando consulta espere...")
my_sql <- gsub("\\?DEP",input$depto,gsub("\\?STORE_NBR",input$Tienda,gsub("\\?OLD_NBR",input$Articulo,my_sql)))
resultset <- connector.execute(name="WM3", statement=my_sql)
values$mydata<-resultset
})
})
output$Item <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,9]
}
paste0(valor,sep="")
})
output$Desc <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,13]
}
paste0(valor,sep="")
})
output$Proveedor <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,4]
}
paste0(valor,sep="")
})
output$NoProv <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,3]
}
paste0(valor,sep="")
})
output$Depto <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,1]
}
paste0(valor,sep="")
})
output$Categoria <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,5]
}
paste0(valor,sep="")
})
output$EffectiveDate <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,17]
}
paste0(valor,sep="")
})
output$Cedis <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,20]
}
paste0(valor,sep="")
})
output$VndrPack <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,18]
}
paste0(valor,sep="")
})
output$ItemType <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,14]
}
paste0(valor,sep="")
})
output$OrderBook <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,16]
}
paste0(valor,sep="")
})
output$CarryOption <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,22]
}
paste0(valor,sep="")
})
output$WhsePack <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,19]
}
paste0(valor,sep="")
})
output$StatusCode <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,15]
}
paste0(valor,sep="")
})
output$CW <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,21]
}
paste0(valor,sep="")
})
output$CarriedStatus <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,23]
}
paste0(valor,sep="")
})
output$PromVtaWkly <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,23]
}
paste0(valor,sep="")
})
output$PromFcstWkly <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,23]
}
paste0(valor,sep="")
})
output$PromShipsWkly <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,23]
}
paste0(valor,sep="")
})
output$OnHand <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,24]
}
paste0(valor,sep="")
})
output$Intransit <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,25]
}
paste0(valor,sep="")
})
output$InWarehouse <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,26]
}
paste0(valor,sep="")
})
output$OnOrder <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,27]
}
paste0(valor,sep="")
})
output$Total <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,28]
}
paste0(valor,sep="")
})
output$StockOuts <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,23]
}
paste0(valor,sep="")
})
output$AjustesIP <- reactive({
if(is.null(values$mydata)){
valor='-'
}else{
valor=values$mydata[1,23]
}
paste0(valor,sep="")
})
}
shinyApp(ui=ui,server=server)
thanks a lot.