Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Pran1858
Contributor
Contributor

Need a JSON SQL to load the arrays.

I am new to QLIK Sense. I need help in getting this JSON Data loaded into a table.

 

Data loaded from QLIK Sense generated SQL is incorrect. The first 4 columns have correct data and rest don't.

Sample Data:

[{"name":"Dept1","Issues":[{"apps":54,"CRITICAL":37609},{"apps":59,"SEVERE":241422},{"apps":56,"MODERATE":476982},{"apps":17,"LOW":20835},{"apps":15,"NEGLIGIBLE":22572}]},
{"name":"Dept2","Issues":[{"apps":114,"CRITICAL":57275},{"apps":114,"SEVERE":148314},{"apps":103,"MODERATE":158047},{"apps":14,"LOW":6173},{"apps":14,"NEGLIGIBLE":4138}]}]

 

QLIK Sense generated SQL:

RestConnectorMasterTable:
SQL SELECT
"name",
"__KEY_root",
(SELECT
"apps",
"CRITICAL",
"SEVERE",
"MODERATE",
"LOW",
"NEGLIGIBLE",
"__FK_Issues"
FROM "Issues" FK "__FK_Issues")
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION(Url "https://sampleServerRESTURL/");;

[Issues]:
LOAD [apps],
[CRITICAL],
[SEVERE],
[MODERATE],
[LOW],
[NEGLIGIBLE],
[__FK_Issues] AS [__KEY_root]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_Issues]);


[root]:
LOAD [name],
[__KEY_root]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY_root]);


DROP TABLE RestConnectorMasterTable;

 

 

 

Labels (1)
2 Replies
Quy_Nguyen
Specialist
Specialist

Hi,

What did you get from that script? This is mine and I think it is correct

Quy_Nguyen_0-1617818686665.png

 

Pran1858
Contributor
Contributor
Author

Quy,

Thanks for validating it. I am a newbie to QLIK Sense JSON world. I  did import the data to table and it is working as expected. QLIK Sense "collapses" values into single row if they have same value.

Understood and all good for now. Thanks for your help and time.

Appreciated.