No Results
Automation: How to Fetch Data

edgeCore version: 4.4.2

This Automation step enables you to use data from feeds of any connection within Edge and as such can be useful in various scenarios where you need data from other connections.  The advantage of the Fetch Data step is that the connection does not have to be present on the page in form of visualization.

There are multiple ways you can use this script step.
1. You can fetch data calling one of the available Feeds
2. You can also get one of these metrics:
– All Job Statuses
– Job Status Metrics by Job Key
– Job Status Metrics by Producer Name
– Script Names

In this example, we are going to implement the Fetch Data step. You can watch a demo here.

We start by creating the Server Filesystem connection and CSV Feed
from that connection. When creating a feed, we have selected the user.csv file from the data folder in our root edge folder.
After that, we have created two visualizations — Table and HTML template. The table will be populated with rows from the CSV file and the HTML template will serve as a place to show transformed data.

Next steps are creating a page and adding visualizations, creating a script and Click Row action.

The Automation script should have 2 steps — the first one is the Fetch Data step and the second one is JS Eval. Inside of the Fetch Data step, we have chosen a feed that will be called and ScriptVar Name, which represents value that the chosen feed will return.
Afterward, we can create a JS Eval step and use the value that we created in the previous step.

The code for the JS Eval step is as follows:

var user = scriptVar.fetchedUsers.filter((obj) => {
return obj.userId == scriptVar.userId
user = user[0];

$(‘.content’).css(“display”, “block”);
$(‘.content-img’).attr(“src”, user.url);
$(‘#lastname’).html( user.lastName)

The last step is to create and configure the Row Click action. When configuring this action, we have selected our script from the drop-down menu. Having done this, we proceed by adding a variable userId. Moreover, for the Mapped Value, we have selected Record Value (userId).

Terms | Privacy