Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
nkumarkanduri
Contributor II
Contributor II

Rest API connection

Hi All,

I am having an issue loading the data from a rest connection. The problem is there is a column which repeated twice with exact name in the source because of which the qlik is not letting me select Header as true (It is not accepting duplicates). If I do not select header as true then it is going to assign col1,col2, so on as column names. However, I went getting the data with columns as col1, col2, col3 etc. Later, I am trying to change the column names with peek function by considering the first row value as the column name. but, it is not accepting the peek function. Is there any solution for this? Please find the sample code:

LIB CONNECT TO 'final export (cysemi_niki)';

RestConnectorMasterTable:
SQL SELECT
"col_1",
"col_2",
"col_3",
"col_4",
"col_5",
"col_6",
"col_7",
"col_8",
"col_9",
"col_10"
FROM CSV (header off, delimiter ",", quote """") "CSV_source";

[test]:
LOAD [col_1],
[col_2],
[col_3],
[col_4],
[col_5],
[col_6],
[col_7],
[col_8],
[col_9],
[col_10]
RESIDENT RestConnectorMasterTable;

NoConcatenate
[abc]:
load
[col_1] as peek('col_1',0,'test'),
[col_2] as peek('col_2',0,'test'),
[col_3] as peek('col_3',0,'test'),
[col_4] as peek('col_4',0,'test'),
[col_5] as peek('col_5',0,'test'),
[col_6] as peek('col_6',0,'test'),
[col_7] as peek('col_7',0,'test'),
[col_8] as peek('col_8',0,'test'),
[col_9] as peek('col_9',0,'test'),
[col_10] as peek('col_10',0,'test')

resident test;

DROP TABLE RestConnectorMasterTable;

 

The above code is showing error at peek function. Please note that for simplicity purpose i have taken only few columns, but in the data I have more than 200 columns.

 

Thanks,

Nithin.

0 Replies