Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
BI_Dev
Creator II
Creator II

Task load based on Filetime

Is there a task to setup the DB load based on the filetime ?

Run the task only if the date(Filetime) = Date (Today()) or Load the DB only if the date(Filetime) = Date (Today())  ?

Either in Qlikview or Qliksense

Thank you.

 

 

 

 

Labels (6)
1 Reply
vmoreno2605
Creator
Creator

I believe there is no way to ask something like that to a task, however, i had the same issue a couple of weeks ago, let me explain you so you can know if this is gonna be useful to you.

I have an app that needs some data from an excel, this excel is supposed to be modified a couple of times in a month (it's gonna depend on the business), we dont want to reload the app manually so we created an script that validates when the excel is modified, this script runs every 20 minutes. When the person modifies the file, the app validates it's last updated datetime and runs the script, if the excel wasn't modify it only load 3 QVD (this are created by running the script when the excel is modified)

 

SET excel_file = 'lib://8.-OP-MT-IMPORT/Rangos.xlsx' ; //this is my excel
SET qvd_file ='lib://2.-OP-MT-QVD/1.Ext\Daily.qvd'; //this is another file that is validated as well

// this takes the last time this file was modified
LET fecha_excel= Timestamp((FileTime( '$(excel_file)' )));
LET fecha_qvd= Timestamp((FileTime( '$(qvd_file)' )));


LET fecha_actual= Timestamp(NOW()); //this gets this moment

// Here, we verify that our Excel and QVD were modified
LET fecha_excel_delta = Interval( fecha_actual - fecha_excel,'m' );
LET fecha_qvd_delta = Interval( fecha_actual - fecha_qvd,'m' );

//If the excel/qvd was recently modify, the next if gets 1, otherwise it gets 0

LET lanzar_recarga = if( $(fecha_excel_delta) < 5 OR $(fecha_qvd_delta) >= 1140,1,0);

if $(lanzar_recarga) = 0 THEN

//something

//here, i load only 3 QVD

else

//something else

//Here i run all the script and at the end it creates the 3 qvd that were used before.

end if;

 

Im sorry because of my english skills bro, i hope it helps you