sdcConnect(url, user="", password="") sdcGetInfo(conn, path) sdcGetData(conn, path, ..., parameters=NULL, view=NULL, maxRows=NULL, file=NULL)
url | a character string specifying the URL of a Spotfire Web Player to access. This is normally a full URL; for example, "http://srvtest04/SpotfireWeb". |
user | a character string specifying the user name to log in to the Spotfire Web Player. |
password | a character string specifying the user password to log in to the Spotfire Web Player. |
conn | an object returned by sdcConnect that specifies the Spotfire Web Player to access. |
path | a character string specifying the path to a data connection on the server. |
... | Any number of named parameters specified to access the data connection. |
parameters | If this argument is given, it is used to specify the parameter names and values, rather than the contents of the ... arguments. This argument allows using parameters with the same names as the arguments to sdcGetData. |
view | a character string specifying the view name of the data connection. This must be specified only if the data connection has more than one view. |
maxRows | an integer giving the maximum number of rows to retrieve. If it is NULL or less than one, all of the data rows are retrieved. This value can be ignored for some types of Spotfire data connections. |
file | if this argument is given, it must be a file name where the retrieved data is stored in the SBDF file format. If it is not given, the retrieved data is returned as a data.frame. |
sdcGetInfo returns a SpotfireDataConnectionInfo object, which has a print method that displays information about the given data connection necessary to access its data. This information includes one or more named "views" included for the data connection, as well as "parameters" that must be specified for each view. See the Example section for a demonstration of how this information is printed.
If a data connection has more than one view, you must specify the view to use (by giving its view name) when retrieving its data. If a data connection has only one view, the view name does not need to be specified.
A data connection view has zero or more named parameters that you can specify when retrieving its data. When you print the object returned by sdcGetInfo, note that the parameters are printed as a data.frame with the following columns:
Name | The parameter name. |
DataType | The type of data expected for the parameter. |
Required | If TRUE, then this parameter must be specified. |
AllowMultipleValues | If TRUE, then this parameter can have more than one value specified. |
IsRangeValues | If TRUE, then specify this parameter as two numeric values: a lower range and an upper range value. |
A SpotfireDataConnectionInfo object is implemented as a list with the following elements:
server | The URL to the server. |
path | The specified path to the data. |
LibraryId | An ID used to specify the dataset to the server. |
Views | A list of SpotfireDataConnectionView objects describing each of the views. |
A SpotfireDataConnectionView object is implemented as a list with the following elements:
ViewName | The name of the view. |
RequireDatabaseCredentials | A logical value that is true if the view requires specifying database credentials. |
Parameters | A data.frame describing the parameters, with the columns described above, as well as an additional Id column used to specify the parameter to the server. |
sdcConnect | returns a SpotfireDataConnection object that identifies a particular Spotfire Web Player. |
sdcGetInfo | returns a SpotfireDataConnectionInfo object containing information about the views and parameters of a specified data connection. |
sdcGetData | returns a data.frame with the retrieved data (unless file is specified, in which case it returns NULL). |
## Not run: # Connect to a Web Player conn <- sdcConnect("http://myServer/SpotfireWeb", "myname", "mypassword")# Retrieve and print info about a data connection print(sdcGetInfo(conn, "/MyFolder/SalesWithParameters")) ## Spotfire data connection info ## server: http://myServer/SpotfireWeb ## path: /MyFolder/SalesWithParameters ## 1 view ## ## Spotfire data connection view: "SalesWithParameters" ## Parameters: ## Name DataType Required AllowMultipleValues IsRangeValues ## 1 Region String TRUE TRUE FALSE ## 2 Sales Total SingleReal TRUE TRUE TRUE ## 3 ShipContains String TRUE FALSE FALSE
# Retrieve data with specified parameters, # where parameter "Sales Total" specifies the range 100 to 300, # and the other parameters are strings. salesData <- sdcGetData(conn, "/MyFolder/SalesWithParameters", Region="WEST", "Sales Total"=c(100,300), ShipContains="SMALL") ## End(Not run)