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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading from QVD file with Conditionals

Hello, i want to know if its possible to load data from a QVD file usig some conditionals. For example, what do i if i wat to load only data with the column ID_Job = '007' ?

Do i use 'case', 'if' or something like that? plase, an example would it great. Thanks

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Looks like the if() statement is what you're looking for:

LOAD
...
,if(HnuFA3_01C = 9500,HnuA04_15P,0) as C_ActPond_Riesgo
,if(HnuFA3_01C = 9501,HnuA04_15P,0) as C_PatrimonioEfec
...
FROM MyQVD.qvd (QVD);

View solution in original post

5 Replies
rbecher
MVP
MVP

Just use a Where Clause like this:

LOAD
...
FROM [<qvd-file>] (qvd)
WHERE ID_Job = '007';

Ralf

Astrato.io Head of R&D
Not applicable
Author

Thank you, Ralf. I made a mistake explaning my problem. I want to add special columns from calculated values using coditionals. Here's my script using a data source:

HNUA04:
LOAD *, "HnuA04_16P",
HnuA04PCOp,
"HnuFA3_01C",
C_ActPond_Riesgo, C_PatrimonioEfec,
C_ColoMes_SF, C_CastigoAnual;
SQL SELECT *, HnuA01_01A * 100 + HnuA04_01M Periodo,
Case When HnuFA3_01C = 9500 Then HnuA04_15P Else 0 End As C_ActPond_Riesgo,
Case When HnuFA3_01C = 9501 Then HnuA04_15P Else 0 End As C_PatrimonioEfec,
Case When HnuFA3_01C = 9502 Then HnuA04_15P Else 0 End As C_ColoMes_SF,
Case When HnuFA3_01C = 9503 Then HnuA04_15P Else 0 End As C_CastigoAnual
FROM "DWH_MIS".dbo.HNUA04;
Store HNUA04 Into HNUA04.qvd;
Drop Table HNUA04;



As you can see, i use "case when" because the SQL connector can read this command over my "DWH_MIS".dbo.HNUA04 resource. But what if i use a QVD file as source? I can't use the 'SQL SELECT' nor 'CASE WHEN'. The thing is that i want to the the same load within using a .dbo source; i would like to use a QVD file as source, but i have problems with sintaxis.

Thanks.

johnw
Champion III
Champion III

Looks like the if() statement is what you're looking for:

LOAD
...
,if(HnuFA3_01C = 9500,HnuA04_15P,0) as C_ActPond_Riesgo
,if(HnuFA3_01C = 9501,HnuA04_15P,0) as C_PatrimonioEfec
...
FROM MyQVD.qvd (QVD);

rbecher
MVP
MVP

You can use if() function:

LOAD
...
if(HnuFA3_01C = 9500, HnuA04_15P, 0) as C_ActPond_Riesgo,
...
FROM [<qvd-file>] (qvd);

Ralf

Astrato.io Head of R&D
Not applicable
Author

Thank you, Ralf and Jhon 😄 It runs!

Greetings from Peru!