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
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.
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.