0

I have a text input which is "inputProductID" and action button which is "actionGetDetails"

After entering a specific product ID say 12345 in the text input, I click on the action button. On clicking the action button I wish to call a function which takes in product ID as input argument and give a dataframe as output. The dataframe has single row and various columns like ProductName, productDescription etc. I wish to take the value of ProductName from the dataframe and display/render to the output text field on that action button click. here is what I tried:

            shinyServer(function(input, output,session) {

              # Here actionGetDetails is the action button
              # inputProductID is the input text field
              ntext <- eventReactive(input$actionGetDetails, {
                 getProductDetails(input$inputProductID)
                 # This function returns a dataframe have a field ProductName
              })

              # Here  output$textvar is the 
               output$textvar <- renderText({
                 ntext$ProductName
                })

I get an error on the app:object of type 'closure' is not subsettable.

I tried using the combination of observeEvent() and reactivevalues Anyhelp in solving this would be appreciated.

1 Answer 1

1

ntext is a function returning a data.frame, so you have to use it like this :

output$textvar <- renderText({
             ntext()$ProductName
            })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.