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: 
Jonathan_Alm
Partner - Creator
Partner - Creator

Concatenate and exist

Hi,

I have a section access issue where we have a central file for general section access, and a custom file for users who need a different access in some applications.

The custom file consist of the following rows:

NTNAME ACCESS PERMISSIONS
ZZZ/LISA ADMIN *

 

The general section access file consist of the following rows:

NTNAME ACCESS PERMISSIONS
ZZZ/LISA USER SALES
ZZZ/LISA USER ORDERS
ZZZ/MARK USER SALES 
ZZZ/ADAM ADMIN *
ZZZ/CLAIRE USER SALES
ZZZ/CLAIRE USER ORDERS

 

I want to remove LISAS rows in the general table and replace them with new access, but at the same time keep MARK, ADAM and CLAIRES rows. 
I have tried the following syntax, but that removes CLAIRES second row:

LOAD * INLINE
[
NTNAME, ACCESS, PERMISSIONS
ZZZ/LISA, ADMIN, *
];

Concatenate
LOAD distinct
NTNAME,
"ACCESS",
PERMISSIONS
FROM
$(vG.ExtractPath)/SectionAccess.qvd (qvd) where not exists(NTNAME);

 

Result = Correct for LISA but CLAIRE's second row is missing.

NTNAME ACCESS PERMISSIONS
ZZZ/LISA ADMIN *
ZZZ/MARK USER SALES 
ZZZ/ADAM ADMIN *
ZZZ/CLAIRE USER SALES

 

 

I want the following result.

 

NTNAME ACCESS PERMISSIONS
ZZZ/LISA ADMIN *
ZZZ/MARK USER SALES 
ZZZ/ADAM ADMIN *
ZZZ/CLAIRE USER SALES
ZZZ/CLAIRE USER ORDERS

 

Any suggestions?

Kind regards, Jonathan

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

@Jonathan_Alm This is explained in this article:

https://community.qlik.com/t5/Knowledge/WHERE-NOT-EXISTS-clause-returns-only-one-row-for-each-non/ta...

something like this...

data:
load *
,NTNAME as tempNTNAME
;
load
*
from https://community.qlik.com/t5/App-Development/Concatenate-and-exist/td-p/1866050
(html, utf8, embedded labels, table is @1)
;

concatenate(data)
load *
from https://community.qlik.com/t5/App-Development/Concatenate-and-exist/td-p/1866050
(html, utf8, embedded labels, table is @2)
where not exists(tempNTNAME,NTNAME)
;

drop field tempNTNAME;
exit script;

View solution in original post

2 Replies
stevejoyce
Specialist II
Specialist II

@Jonathan_Alm This is explained in this article:

https://community.qlik.com/t5/Knowledge/WHERE-NOT-EXISTS-clause-returns-only-one-row-for-each-non/ta...

something like this...

data:
load *
,NTNAME as tempNTNAME
;
load
*
from https://community.qlik.com/t5/App-Development/Concatenate-and-exist/td-p/1866050
(html, utf8, embedded labels, table is @1)
;

concatenate(data)
load *
from https://community.qlik.com/t5/App-Development/Concatenate-and-exist/td-p/1866050
(html, utf8, embedded labels, table is @2)
where not exists(tempNTNAME,NTNAME)
;

drop field tempNTNAME;
exit script;

Jonathan_Alm
Partner - Creator
Partner - Creator
Author

Hi,

works like a charm! Thanks

Kind regards, Jonathan