Search…
Data Integration
RealityHub allows you to integrate external data sources such as weather, finance, elections, and sports right inside your 3d virtual studio, augmented reality configurations, and mixed reality setup.
With version 1.2, RealityHub supports scripting to ingest data from popular database management systems such as MSSQL, MySQL, PostgreSQL.
We also added XLSX and CSV filetype support which you can store on a local drive, shared folder, or website.
Data Integration Workflow

Data Integration Workflow

Every production pipeline has its method and steps to create and publish content, including data integration.
Since there is no monolithic approach to the data integration workflow, the most widespread practice involving Reality Engine/Unreal Engine and RealityHub may have to apply the following steps:
  1. 1.
    Designing content inside an Engine
  2. 2.
    Exposing variables/functions to RealityHub
  3. 3.
    Launching the project via Launcher module or Playing the project in the Editor Mode
  4. 4.
    Building a Form Template based on the Properties and Functions of the node
  5. 5.
    Adding the HTTPS/JSON/JS component to Form Template
  6. 6.
    Defining the data source in the Field Settings
  7. 7.
    Assigning key names based on incoming data
  8. 8.
    Checking results via Playout module

Reality External Data

Reality External Data is a component that allows you to integrate your external data directly into the Form Template design. External data integration has the following steps:
  • Binding Data
  • Ingesting Data
Ingesting data sources can be done by the following methods:
  • Downloading data from URL
  • Executing a Javascript Function

Download Data From URL

  • Activate the Form Builder module
  • Create a New Form
  • Go to Components > External Data
  • Drag and drop the HTTP JSON JS component to your Template Form
  • Click on the Field Settings (
    ) button as shown in the image above
As soon as you click on the Field Settings button, Reality External Data - HTTP(S) Settings window pops up. Now:
  • Click and activate the Download Data From URL checkbox as shown on the image above
  • Define the URL that contains the data you want to ingest into your Template Form.
  • Setting URL parameters requires creating inputs for each parameter (such as string, number, dropdown, etc.) inside the container of the HTTP/JSON/JS component. You can reference those inputs with their keys. (e.g. {realitystring1}).
  • Use a backslash (e.g., \{) to escape curly braces.
  • External Data Components always parse the URL response as JSON.
The URL on the image above is only for illustrative purposes.

Execute a Javascript Function

RealityHub Script Editor
Script Editor inside the HTTP JSON JS component allows you to execute JavaSscript functions. The sample code inside the Script Editor and the code snippet below shows examples of executing JavaScript functions.
Return value defines the JSON data which your Form Template can use; therefore, the return always must be a JSON Object.
/**
* Body of an async function
* @param {object} params Parameters
* @param {object} params.input A key-value object which stores the value of inputs in Remote Data fieldset.
* @param {object} params.data The downloaded data. If the download checkbox is unchecked then this is set to null.
* @returns {Promise<*>} JSON data
*/
try {
const { fetchURL, executeSQL, fetchCSV, fetchXLSX } = imports;
const targetURL = `http://localhost/examples/city-weather-dyn.json?city=${params.input.city}&range=${params.input.from}-${params.input.to}`;
// To fetch data from a website with query string, you can use the following stub.
const data = await fetchURL(targetURL, { format: "json" });
// To fetch data from a given database, you can use the following stub.
/*
const data = await executeSQL({
dialect: "pg",
// dialect: "mysql",
// dialect: "mssql",
// dialect: "sqlite",
host: "127.0.0.1",
port: "5432",
database: "db_name",
user: "db_user",
password: "db_password",
query: "SELECT COLUMN_NAME FROM TABLE_NAME"
});
*/
// To fetch data from a given csv path and parse it then, which can be a local path or an URL containing csv file
// , you can use the following stub.
/*
const data = await fetchCSV({
path: "https://people.sc.fsu.edu/~jburkardt/data/csv/addresses.csv",
option: { separator: ',', headers: false }
})
*/
// To fetch data from a given xlsx path, you can use the following stub.
/*
const data = await fetchXLSX({
path: "https://file-examples-com.github.io/uploads/2017/02/file_example_XLS_10.xls"
});
*/
return data;
} catch (ex) {
console.trace(ex);
// Throwing errors other than `TransformError` will display a generic error message.
throw ex;
}
Copy link
Outline
Data Integration Workflow
Reality External Data
Download Data From URL
Execute a Javascript Function