Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ 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 (3)
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
Champion
Champion

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

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

 

View solution in original post

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...