Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to write if statement in Qlikview

Hi

How to write following code in Qlikview

IF Date(Today()) = YearStart(Today()

     Delete all qvds where qnd name contains Year(Today())-3

Else

     Don't do anything

EndIF

1 Solution

Accepted Solutions
Not applicable
Author

It's done with following code:

 

IF Date(Today()) <> YearStart(Today()) Then

     Let QvdPath = 'D:\QlikView\Test\'; 
     Let vYear = Year(Today()) - 3;

     Let cmd = '*'&$(vYear)&'*.qvd';
execute cmd.exe /c  DEL  $(QvdPath)$(cmd);
EndIf

View solution in original post

6 Replies
brunomarques
Contributor III
Contributor III

Have you tried something like this?

IF Date(Today()) = YearStart(Today()) Then

    

     Let vYear = Year(Today()) - 3;

     Let cmd = 'DEL *' & $(vYear) & '*.qvd';

     execute cmd.exe /c $(cmd)

EndIf

Not applicable
Author

Wher i can give the qvd path if I want to delete from specific folder only like D:\Qlikview\Qvds

Anonymous
Not applicable
Author

Hi

execute cmd /c del "YourPath\YourFile(s)*.qvd";

shree909
Partner - Specialist II
Partner - Specialist II

Hi , Try this

Add a variabel

Set vSourcedir='D:\Qlikview\Qvds\';

     Let vYear = Year(Today()) - 3;

     Let cmd = '*' & $(vYear) & '*.qvd';


   execute cmd.exe /c  DEL  '$(vSourcedir) $(cmd)'


Not applicable
Author

This created below execute statement and not deletiong files from location

 

execute

cmd.exe /c DEL 'D:\QlikView\Test\ *2010*.qvd'

Not applicable
Author

It's done with following code:

 

IF Date(Today()) <> YearStart(Today()) Then

     Let QvdPath = 'D:\QlikView\Test\'; 
     Let vYear = Year(Today()) - 3;

     Let cmd = '*'&$(vYear)&'*.qvd';
execute cmd.exe /c  DEL  $(QvdPath)$(cmd);
EndIf