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: 
antonaks
Creator II
Creator II

Delete or ignore table rows when loading data

Please help in following problem.
Is it possible to delete (or not load) table rows by condition?

For example, something like this:
If SalesDate = '21 .05.2016 'and FilialKey =' 25615'  DELETE ROW ...

I need to ignore part of the lines when loading the script.

Thank you in advance for your help.

1 Solution

Accepted Solutions
antonaks
Creator II
Creator II
Author

Bingo!
I figured it out. A fairly good option works with the use of "OR"

WHERE

FilialKey = '33502' and Date<= '26.07.2017' or

FilialKey = '33525' and Date<= '21.07.2017' or

FilialKey = '33534' and Date<= '25.07.2017' or

FilialKey = '33540' and Date<= '09.06.2017' or

....

View solution in original post

6 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can add a where clause to a load statement to filter out records you don't want to load:

LOAD *

FROM MyTable.qvd (qvd)

WHERE SalesDate <> '21 .05.2016 'and FilialKey <>' 25615'


talk is cheap, supply exceeds demand
techvarun
Specialist II
Specialist II

to Exclude write something like

WHERE SalesDate <>'21 .05.2016 'and FilialKey <> '25615'

antonaks
Creator II
Creator II
Author

Thank you, but this is not exactly what I need. With this solution I have excluded from the table is fully specified Filial and Date. But I need to delete the row at the intersection of the Filial code and Date.

techvarun
Specialist II
Specialist II

The code will delete the intersected records only.

share a sample piece of data and expected output if possible

antonaks
Creator II
Creator II
Author

I think I understood what the problem is. I did not correctly formulate the question. Below is an example of what I want to get.


Initial data:

FilialKeyDateData
3352515.07.20176 017
3352516.07.20173 924
3352517.07.20175 933
3352518.07.20176 069
3352519.07.20178 002
3352520.07.20176 458
3352521.07.20176 751
3352522.07.20173 379
3352523.07.2017
3352524.07.2017
3352525.07.2017
3352526.07.2017
3352527.07.2017
3352528.07.2017
3352605.07.20173 924
3352606.07.20175 933
3352607.07.20176 069
3352608.07.20178 002
3352609.07.20176 017
3352610.07.20177 322
3352611.07.20178 274
3352612.07.20179 488
3352613.07.2017347
3352614.07.2017
3352615.07.2017
3352616.07.2017

Output data:

FilialKeyDateData
3352515.07.20176 017
3352516.07.20173 924
3352517.07.20175 933
3352518.07.20176 069
3352519.07.20178 002
3352605.07.20173 924
3352606.07.20175 933
3352607.07.20176 069
3352608.07.20178 002
3352609.07.20176 017

In the case described above, two conditions must work:

1) Date<= '19.07.2017' and  FilialKey = 33525

2) Date<= '09.07.2017' and  FilialKey = 33526

I have about 50 such paired conditions. Is it possible to use them in one query?

antonaks
Creator II
Creator II
Author

Bingo!
I figured it out. A fairly good option works with the use of "OR"

WHERE

FilialKey = '33502' and Date<= '26.07.2017' or

FilialKey = '33525' and Date<= '21.07.2017' or

FilialKey = '33534' and Date<= '25.07.2017' or

FilialKey = '33540' and Date<= '09.06.2017' or

....