Context Sync - Example

Step

Visual

Detail

Configure Custom Fields for Context Item Types

CS1.png Configure in ConfigHub on an admin account

Create and Context Item Types (include custom fields)

CS2.png Configure in ConfigHub on an admin account
Create SQL Table CS3.png

Tables must include id, componentType, type, description, startEvent, startTime, endEvent, and endTime.  After that, custom fields can be added as additional columns.

Note that in your case, “componentid”, “componenttype”, and “type” column will all likely be the same values for batch sheets.

Componentid is the tag the context item will be associated with, componenttype will likely be TAG, and the type will be the name of the Context Item type you created (ex. Batch Sheet)

Define the data source

CS4.png

Use the TrendMiner API console to obtain data-sourced for sync in later steps:CS5.png

 
Define the Query

CS6.png

CS7.png

CS8.png

The rows from id to endTime are required, and additional custom fields can be added after. 

startDate and endDate will be defined in the syncs.

Test the query within your environment to verify functionality prior to posting via API.

Historical Sync CS9.png

datasourceId and queryId are found using the GET method strings shown in previous steps.  Locate the number of the desired database and query.

Prefix is not required, but can be used to collect context items with the same name from different data sources (ex. using batch id to label different context item types).

Define Sync Job

CS10.png

Use the TrendMiner API console to obtain sync job id:

CS11.png

This sync job will sync with the SQL database every 10 minutes.

 

Note - We recommend inputting a chunk size of 1440

Live Sync Job CS12.png

This will schedule ongoing syncs of the defined database at the defined syncJobInterval.

This example assumes that sync job id is 14.

Enjoying TrendMiner? Share your experience to help the community and receive $25.
Rate TrendMiner