- 2.An IDE setup for your script language e.g:
- VS-Code with the plugins for the script language
- R and RTools
- 3.Open the script in the SF platform
In the SF platform, the execution of datasets for scripts and the assignment to variables is done in the background. These variable names are sanitized and deduplicated, which means they are depending on all the names of the datasets, the column names, and the order they are assigned to the script. Therefore it's no simple task to "guess" the variable name that is created in the background.
In order to be able to easily switch between local development and the SF platform, you should start the script with intermediate variables and assign the variables of the dataset.
Here is a minimal example of how to retrieve data from SF and assign the columns to variables.
rest_url <- "https://<your senseforce backend platform url>/api/dataset/execute/<id>"
header_auth <- c("Authorization" = "Bearer <your API access token>")
header_type <- c("Content-Type" = "application/json")
headers <- add_headers(header_auth, header_type)
req <- POST(rest_url, body = "", headers)
res_df <- data.frame(fromJSON(content(req, "text", "application/json")))
script_variable_1 <- res_df$timestamp
script_variable_2 <- res_df$someColumn
from pandas import DataFrame