Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mvgadagi
Contributor III
Contributor III

How to remove the rows from the QVD Qlik Sense based on the condition

Hello All,

Currently, I have the table stored in the QVD and the table contains the column name as refresh_date, Before I store the new data to this QVD, I wanted to remove all the rows having the refresh_date as Today() ,So even if the script runs multiple times in same day always it removes existing rows and adds the new rows

Thanks,


Labels (2)
1 Solution

Accepted Solutions
lanlizgu
Creator III
Creator III

You can do this in the same QVD

  1. First of all, do a table and select from the QVD except the today dates (a where reading the qvd)
  2. add (concatenate) in the table the new data of the day
  3. store the table with the same name as the qvd
  4. drop the created table in the script

 

View solution in original post

5 Replies
vikasmahajan

Hi ,

You need to load  data from QVD with where date condition in your qlik script and again store into new QVD.

use new QVD in dashboard.

 

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
mvgadagi
Contributor III
Contributor III
Author

But I don't want to create new QVD each time if an App is refreshed multiple times in a day

lanlizgu
Creator III
Creator III

You can do this in the same QVD

  1. First of all, do a table and select from the QVD except the today dates (a where reading the qvd)
  2. add (concatenate) in the table the new data of the day
  3. store the table with the same name as the qvd
  4. drop the created table in the script

 

mvgadagi
Contributor III
Contributor III
Author

Hello,

For some reason, It keeps adding the data again and again If I run the script multiple times in a single day, Can you please help , What is wrong here

Currently 

  1. Checking if QVD exists or not
  2. If exist, I will take all the records which are not today in the record_daily_count
  3. Created the temporary table daily_report which gets the current day data
  4. record_daily_count table is concatenated with  daily_report and stored in QVD
  5. Deleted the temporary table

 

 

record_master_list:
	load * from  'lib://Record_Master_Data\record_master_list.qvd'(qvd);

LET vListqvdexists = isnull(QvdCreateTime('lib://Record_Master_Data\record_daily_count.qvd'));

if vListqvdexists = 0 then
  record_daily_count:
  load * from  'lib://Record_Master_Data\record_daily_count.qvd'(qvd) where not[Extraction_Date] <> Today();
  set division = 'A';
  daily_report:
  NoConcatenate
  Load '$(division)' as 'Division', Today() as 'Extraction_Date' Resident record_master_list;
end if


if vListqvdexists <> 0 then
  set division = 'A';
  daily_report:
  NoConcatenate
  Load '$(division)' as 'Division', Today() as 'Extraction_Date' Resident record_master_list;
end if

set division = 'B';

daily_report:
Concatenate(daily_report)
Load '$(division)' as 'Division', Today() as 'Extraction_Date' Resident record_master_list;


if vListqvdexists = 0 then
  record_daily_count:
  Concatenate(record_daily_count)
  load * Resident daily_report;
  store daily_report into 'lib://Record_Master_Data\record_daily_count.qvd'(qvd);
  drop table daily_report;
end If

if vListqvdexists <> 0 then
	store daily_report into 'lib://Record_Master_Data\record_daily_count.qvd'(qvd);
end if

 

mvgadagi
Contributor III
Contributor III
Author

For some reason this is not deleting existing and creating the new rows , I have posted the question again with extra details , Can you please help
https://community.qlik.com/t5/New-to-Qlik-Sense/How-to-remove-the-rows-from-the-QVD-Qlik-Sense-based...