Unioning Two Informer Datasets Using a Web Query and the Informer REST API
You can combine (union) two or more Datasets in Informer with a Web Query that pulls the data straight from Informer's own REST API. This method reports on Informer data within Informer itself.
Initial setup
Complete these steps before building the Web Query:
- Create a Web Datasource for Informer's API. For this example, use an API Token with Read Only access as the Bearer Token authorization. For more details, see Creating a Web Datasource.
- Select the Datasets to union. Make sure they share at least some Field aliases. Fields whose aliases don't match appear blank for the records that come from the other Datasets.
- Get the Dataset IDs from each Dataset's info icon on the Home page or the Datasets listing page. A Dataset's
owner:slug(such asadmin:northwind-orders) works in place of its ID.
![]()
Building the Web Query
Follow these steps to create a Web Query that unions several Datasets:
- Create a Web Query against the Informer API Datasource.
- Set the Method to
GETand the URL toapi/datasets/{id1}/data, where{id1}is the ID of the first Dataset to union. For example:api/datasets/123-456-789/data. - For the Response Parser, select Custom Script and enter the code below. Replace the values in the
datasetsarray with the IDs of the other Datasets to union.
// The first Dataset should be configured on the Method & URL Tab, and not included here
// List additional dataset ids or owner:slugs here
var datasets = [
'dataset2-id-abcdef',
'dataset3-id-1234567'
];
// ====== DO NOT EDIT BELOW THIS LINE ========
// if there is another dataset after this one
var nextDs = datasets.indexOf(response.config.url.split('/')[2]) + 1;
var isAnotherDs = nextDs < datasets.length; // should be true or false
push(response.data.items);
if ((response.data.start + response.data.count) < response.data.total) {
next({
...response.config,
params: {
...response.config.params,
start: response.data.start + response.data.count
}
});
} else if (isAnotherDs) {
next({
...response.config,
url: `api/datasets/${datasets[nextDs]}/data`,
params: {
...response.config.params,
start: 0
}
});
}
The script reads each Dataset a page at a time and combines the results. Each response from the Dataset data endpoint carries items (the records), start, count, and total, which is how the script knows whether to request the next page of the same Dataset or move on to the next one (see Data Operations in the API reference). Fields with matching aliases line up in the same columns, and Fields that don't match are blank where a Dataset has no value for them.