By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.
Installed connectors Microsoft SQL database, JS Mapper, REST API (see tutorial 1.)
Description
In the following tutorial, we will create a new integration task that loads data from SQL database, transforms them using Javascript and sends them to a new Xeelo DX endpoint.
1. Login
Log in to Xeelo DX and click the Tutorials tile in the Companies section.
2. Creating an integration task
Create a new integration task using the Add button. Change the job name and confirm.
3. Create a new integration step Select data from SQL
Create a new Integration Task Step
Rename the integration step to: Select data from SQL
In the Connector section, search for SQL and choose Microsoft SQL Connector
Add the following in the Output Scheme:
ID: integer
Fruit: String
Price: Double and check Null. This means that the value can take on empty values
Save the scheme as Fruits with price
In the configuration section
Load existing SQL Connection string via blue list icon
Add the following SQL statement:
SELECT [id] ,[fruit] ,[price] FROM [dbo].[dx_demo_fruits]
Save the configuration and integration step
4. Create a following integration step JSMapper - map data
Create a following integration task by clicking on small icon button
Rename integration step to: JSMapper - map data
Select the JS Mapper connector
Change input processing to Bulk
In the Input Scheme, select Fruits with price using the blue icon at the top right
In the Input Mapping, press the double arrow button right next to the Select data from SQL heading
Add the following in the Output Scheme:
ID: integer
Fruit: String
Price: Double and check Null
Weight: Double and check Null
Save the scheme as Fruits with weight
In the configuration section, add following Javascript:
// define array with colors for enhancing data - fruit color
var colors = Array('red','yellow','green','orange','brown');
// data from previous step are stored in variable inputData
// using map function can be all records in array mapped to different values or enhanced about some data
var output = inputData.map(function(item) {
return {
// follow same value into output
ID:item
,Fruit: colors[Math.floor(Math.random()*colors.length)] + ' ' + item.Fruit
,Price: item.Price
// enhance new value to output
,Weight: Math.floor(Math.random() * (1000 - 100) + 100 ) / 100
};
});
// send variable to output schema - must have elements with the same names (also same case) and same data types
return output;
5. Creating Xeelo DX endpoint Send me a fruit
We need to create an endpoint where we send the data. Use the breadcrumbs navigation to close the task and press the Endpoint tile in Tutorials
Press Add
In the General section:
Name endpoint Send me a fruit
Generate a slag using the button
Insert * into the IP filter
Select Type to Input
Save the endpoint
At the top of the endpoint copy the endpoint address, eg. https://your-dx-tutorial-site.online/api/endpoint/tutorials/default-group/send-me-a-fruit
6. Create a following integration step Send data to REST endpoint task
Create and rename an integration task
Vytvořte a přejmenujte integační úlohu
Choose the REST API connector
Change Input processing to Bulk
Select the existing Fruits with weight in the Input scheme
In the Input Mapping section, press the double arrow right next to JS Mapper - map data heading
Na obrazovce integrační úlohy stiskněte v pravé hodní části ikonu podmenu (3 tečky pod sebou) a zvolte hromadné editování kroků (bulk edit steps)
V zobrazeném modálním okně zvolte Data snapshot - Everytime
Uložte
8. Save and close the integration step
To run an integration task: Switch the Runnable / Not runnable checkbox at the top of the screen to the Runable - green backlight state. You may notice that at the same time, the History / Design switch changes to the left
Refresh the Xeelo DX cache using the gray recycle button at the top right of the screen, next to the profile. In this way, Xeelo
Press the green Start button next to the History button. A green message will appear in the lower right corner
On the left side of the screen, press the Reload task runs button
Press the orange Data snapshot button on the last green integration steps and compare the outputs
9. Checking the data on the Xeelo DX endpoint
Open a new browser window and load https://your-dx-tutorial-site.online/api/endpoint/tutorials/default-group/send-me-a-fruit