Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
NicolasRivas
Partner - Contributor III
Partner - Contributor III

Concatenate fields in SQL Statement in QlikView

Hello,

I have do a sql query to a sap table named VBUP, but i have to select filter the rows that doesn't already exists in a QVD I have stored of that same table. I am trying a lot of ways but I am not able to concatenate the fields in the sql statement to compare it to the values of the QVD. this is what I am trying now:

 

EXISTENTES:
FIRST 10 LOAD
	%KEY_VBUP_MANDT_POSNR_VBELN
FROM
[..\QVD\DATA_SAP_01_AR_400_VBUP.QVD]
(qvd);

EXISTENTES_SIN_CHAR:
NOCONCATENATE LOAD
	CONCAT(PURGECHAR(%KEY_VBUP_MANDT_POSNR_VBELN,'|'),',')	AS %KEY_VBUP_MANDT_POSNR_VBELN
//	PURGECHAR(%KEY_VBUP_MANDT_POSNR_VBELN,'|')				AS %KEY_VBUP_MANDT_POSNR_VBELN
RESIDENT EXISTENTES;
DROP TABLE EXISTENTES;

LET vFilterValues = PEEK('%KEY_VBUP_MANDT_POSNR_VBELN',0,'EXISTENTES_SIN_CHAR'); // You need to generate this list from QlikView


$(S_NmTabla) :   // Documento de ventas: Datos de cabecera
LOAD 
  MANDT, 
  POSNR,
  VBELN;
SQL Select
	MANDT 
	POSNR 
	VBELN
FROM VBUP
WHERE (MANDT || POSNR || VBELN) IN ($(vFilterValues))
;

 

 

I already tried with + or & or || or with concat(mandt,posnr,vbeln) but i always get some error,

I have to fitler it in the sql because I dont want to retrieve ALL the rows so I can lower the execution time.

Labels (1)
20 Replies
seanbruton

Superb !!! & Simple