RStudio Connections preview

Hello, I am trying to make an extra add-in to SAS Viya inside R Studio ide through the connections.
Everything kinda works except the part that I can't click on a table to preview it.

I am following everything on Connections contracts as stated in the docs

(Connections Contract)

but I can't preview a table whatsoever, even though I can see all of it's table values (but not an small icon in the right side, to preview it).

I was wondering if It could be something with the function I put inside of previewObject (the output for this part is a data.frame) or maybe listObjectTypes but doesn't seems to be.

Any ideia what could it be?

Does your listObjectTypes indicate that these object types contain data?

The contains member is either a list of object types that the object contains, or the special value "data" if the object contains data.

Yes, they do!
The basic structure. For a while I thought that this was the problem, but doesn't seem to fit.

how listObject types is defined:

observer$connectionOpened( [...],

                listObjectTypes = function() {

casListObjectTypes <- function() {
    list(caslib = 
             list(contains = 
                      list(castable = 
                               list(contains = "data"))))

The structure seems correct.
I've also tried to adding icon but to no success.

You can try to update your connection and see if you got any success.

If the list of objects in your data source changes while the connection is open, your R package can tell RStudio to refresh the Connections Pane to show the new information. This is done by invoking the connectionUpdated() method as follows:

observer <- getOption("connectionObserver")
if (!is.null(observer))
  observer$connectionUpdated(type, host)

The RStudio Connections Pane can display database-like connections from any R package which implements a connections contract.

Indeed I hadn't added that to my code before. (connectionUpdated)
I've tried it this way:

on_connection_updated <- function(hostname, hint) {
  # make sure we have an observer
  observer <- getOption("connectionObserver")
  if (!is.null(observer))
  observer$connectionUpdated(type = "Viya", 
                             host = hostname, 
                             hint = hint)

I didn't see any change, no bugs, auto refreshing nor what I want, which is the preview table.
I still think it is something on the previewObject() part, but I can't figure out whatsoever since its otuput is supposed to have is a data.frame so, no reason not to a have a preview.

I am really confused

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.