
SpotFire and Streambase are one of the top-selling business products of TIBCO in the market. The former does the data analysis , Dashboards (etc).. the latter does the streaming data with Real-time system.
Why Integration needed between these two ?
With both real-time and past data in one roof , business users can make an immediate and effective decision on the present and past data analysis.
This blog post aims at covering one such integration between these two Using R by sending data from StreamBase to SpotFire.
ALTERNATIVE APPROACH :
There is quite an alternative approach already for this, using DataBase or some connectors using Apache Spark (etc..) in StreamBase.
But in this blog we purely aim to attain a solution only using R scripts as a Medium. Let’s go Step by Step and achieve this case.
Step 1 : Create a StreamBase Project .
I have created a simple StreamBase project and In the application process , I have created three parameters in the input stream as name , age and city.
name – string age – int city – string

Send the input Parameters to TERR , which will eventually send it to SpotFire Using the below script in TERR

StramBase TERR R Script :
#load the libraries
library(RinR)
library(Sdatasets)
#Set the working Directory and execute in Below R Engine path
RinR::pushPATH(“C:/Program Files/R/R-3.3.1/bin”)
REvaluate(version$version.string, REvaluator)
setwd(“C:/Users/Nithish/Documents”)
iris.env<- environment()
#Create a Rdata at the backEnd. ( Initially it will be empty) and load the RData dd<-load(“C:/Users/Nithish/Documents/import.RData”, envir = iris.env) iris.imp<-iris.env$lvspf
#Assign the name,age city to variables a,b,c
a <- $[name]
b <-$[age]
c <- $[city]
#Create a data frame for a,b,c
newdata<- data.frame(a,b,c)
lvspf <- rbind(iris.imp,newdata)
#Update the Rdata file
save(lvspf, file=”import.Rdata”)
Step 2 : Create a SpotFire Project and Integrate StreamBase Data Open Tibco SpotFire and create an R script to import the Rdata used in Streambase project.

SpotFire DataFunction Properties Script :
#Upload the library and set the R Environment
library(RinR)
library(Sdatasets)
RinR::pushPATH(“C:/Program Files/RStudio/bin”)
REvaluate(version$version.string, REvaluator)
#set the working Directory and load the RData file
setwd(“C:/Users/Nithish/Documents”)
iris.env <- environment()
dd <- load(“C:/Users/Nithish/Documents/import.RData”, envir = iris.env)
lvspf12345 <- iris.env$lvspf
Create the output as table in Edit Parameters for the correspoonding data function

Click OK and see the Created Table. To update or refresh the new data created in StreamBase, Click the Refresh. ( I have created a refresh Function in Text Area of Spotfire which will call the Data Function on every click. )
Test a Scenario :
1. Run the StreamBase project . Enter the name , age and city parameters. In the below I have given the two data 1. Rooney , 35 , Manchester 2. Pogba , 24 , Manchester

2. In Spotfire click the Refresh button and see the new added Entries in the table

