Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jerry_ile
Contributor III
Contributor III

Union tables brought in via rest api

Hi,

I am pulling in data from 2 rest api connections and want to union them both together in a single table.

They currently union if they are the only tables in the app when others are present they join in seperate tables :

Can anyone please advise how to union them

This is my load script

LIB CONNECT TO 'APIv1';

RestConnectorMasterTable:
SQL SELECT
    "name",
    "code",
    "Was",
    "Now",
    "image"
FROM JSON (wrap off) "Clearance";

[ClearancePricing]:
LOAD    [name] AS [Lipname],
    Replace([code],'-','') AS [Lipcode],
    [Was] AS [LipWas],
    [Now] AS [LipNow],
    [image] AS [Lipimage]
RESIDENT RestConnectorMasterTable;


DROP TABLE RestConnectorMasterTable;

LIB CONNECT TO 'APIv2';

RestConnectorMasterTable:
SQL SELECT
    "name",
    "url",
    "Now",
    "Was",
    "image"
FROM JSON (wrap off) "selection2";


LOAD    [name] AS [Lipname],
mid(image,Index(image,'/',-1)+1,len(image)-Index(image,'.',-1)-1) AS Lipcode,
    [Was] AS [LipWas],
    [Now] AS [LipNow],
    [image] AS [Lipimage]
RESIDENT RestConnectorMasterTable;


DROP TABLE RestConnectorMasterTable;

Labels (1)
  • union

1 Solution

Accepted Solutions
jerry_ile
Contributor III
Contributor III
Author

Figured it out please ignore, just had to shift things around a little and concatenate

LIB CONNECT TO 'APIv1';

RestConnectorMasterTable:
SQL SELECT
    "name",
    "code",
    "Was",
    "Now",
    "image"
FROM JSON (wrap off) "Clearance";

LIB CONNECT TO 'APIv2';

RestConnectorMasterTable1:
SQL SELECT
    "name",
    "url",
    "Now",
    "Was",
    "image"
FROM JSON (wrap off) "selection2";

[Pricing]:
LOAD    [name] AS [Lipname],
    Replace([code],'-','') AS [Lipcode],
    Replace([Was],'Original ','') AS [LipWas],
    [Now] AS [LipNow],
    [image] AS [Lipimage]
RESIDENT RestConnectorMasterTable;

concatenate

LOAD    [name] AS [Lipname],
mid(image,Index(image,'/',-1)+1,len(image)-Index(image,'.',-1)-1) AS Lipcode,
    [Was] AS [LipWas],
    [Now] AS [LipNow],
    [image] AS [Lipimage]
RESIDENT RestConnectorMasterTable1;

DROP TABLE RestConnectorMasterTable;
DROP TABLE RestConnectorMasterTable1;

View solution in original post

1 Reply
jerry_ile
Contributor III
Contributor III
Author

Figured it out please ignore, just had to shift things around a little and concatenate

LIB CONNECT TO 'APIv1';

RestConnectorMasterTable:
SQL SELECT
    "name",
    "code",
    "Was",
    "Now",
    "image"
FROM JSON (wrap off) "Clearance";

LIB CONNECT TO 'APIv2';

RestConnectorMasterTable1:
SQL SELECT
    "name",
    "url",
    "Now",
    "Was",
    "image"
FROM JSON (wrap off) "selection2";

[Pricing]:
LOAD    [name] AS [Lipname],
    Replace([code],'-','') AS [Lipcode],
    Replace([Was],'Original ','') AS [LipWas],
    [Now] AS [LipNow],
    [image] AS [Lipimage]
RESIDENT RestConnectorMasterTable;

concatenate

LOAD    [name] AS [Lipname],
mid(image,Index(image,'/',-1)+1,len(image)-Index(image,'.',-1)-1) AS Lipcode,
    [Was] AS [LipWas],
    [Now] AS [LipNow],
    [image] AS [Lipimage]
RESIDENT RestConnectorMasterTable1;

DROP TABLE RestConnectorMasterTable;
DROP TABLE RestConnectorMasterTable1;