Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
siva_boggarapu
Creator II
Creator II

Trigger Load based on Dates from Excel

Hi Team,

Customer has given me a file with YearMonth and Dates. The file has to check YearMonth and Dates and my Script Start  Loading the data 

Please check the attached. For example customer will place the files on 04/19/2021 in shared folder as attached file. 

Then the load starts by 04/19/2021 similarly every month customer will place the files. It has to check file Dates and start loading. Finally script only run as per attached files

Please let me know how I can achieve this

Regards,

Siva

9 Replies
siva_boggarapu
Creator II
Creator II
Author

For Example in the below Script. If Date is  4/19/2021 then start loading else it doesn't need to start

Load * Inline

[

YearMonth,Date
Apr-21 ,4/19/2021
May-21, 5/19/2021
Jun-21, 6/18/2021
Jul-21 ,7/18/2021

];

 

Then Start my Load Script

Load * from QVD;

 

siva_boggarapu
Creator II
Creator II
Author

something I want achieve like below mentioned

 

Trigger:

Load * Inline

[
YearMonth, Date
Apr-21, 4/19/2021
May-21, 5/19/2021
Jun-21, 6/18/2021
Jul-21, 7/18/2021
];

IF(WeekDay(Today())<>6 OR WeekDay(Today())<>7) and

(Load *
resident Trigger
where Date>='04/19/2021';)

Then

Load * From example.qvd;

end if;

MayilVahanan

HI @siva_boggarapu 

Are you want to find the trigger table has value or not? If there is value, need to load some qvd.. Is it right? 

If so, try like below

Trigger:
Load * Inline
[
YearMonth, Date
Apr-21, 4/19/2021
May-21, 5/19/2021
Jun-21, 6/18/2021
Jul-21, 7/18/2021
];

Let vMinDate = Peek('Date',0); // it will store the first value in the Date field i.e. 4/19/2021

If NoOfRows('Trigger') > 0 then

LOAD * from example.qvd;

ENDIF

Suppose, if you want to load from 19th Apr, then use this variable vMinDate in where condition.

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
siva_boggarapu
Creator II
Creator II
Author

Hi Mayil Vahanan R,

Much appreciated your quick response. Yes, I got the solution almost as you posted in Community.

But I want check the date every month. How it is possible. For example May Month Load should run 5/19/2021 date. and skip april date ie 4/19/2021

Please could you let me know how can we achieve this?

Regards,

Siva

 

MayilVahanan

HI @siva_boggarapu 

If its always 19th Of every month, then try like this

Let vMinDate = MakeDate(Year(Today()), Month(Today()), 19);

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
siva_boggarapu
Creator II
Creator II
Author

Hi MayilVahanan,

No, the date would be Dynamic . How we  can get if Run the script in May ,Jun ,July

And It should not pick Previous dates and only get the current year and current month dates

Thanks,

Siva

siva_boggarapu
Creator II
Creator II
Author

Source:
LOAD *
Where MonthYear = text(Date(Today(), 'MMM-YY'));

load text(Date(Date, 'MMM-YY')) as MonthYear, *;
Load Date#(Date, 'MM/DD/YYYY') as Date
Inline
[
Date
01/15/2021
02/28/2021
03/05/2021
04/07/2021
05/19/2021
06/18/2021
07/18/2021
08/10/2021
09/21/2021
10/26/2021
11/27/2021
12/09/2021
];

LET vLoad_Date = Date(Peek('Date', 0, 'Source'));

if Match(vLoad_Date, Today()) then
TRACE 'True Section';
ELSE
TRACE 'False Section';
ENDIF

EXIT SCRIPT;

siva_boggarapu
Creator II
Creator II
Author

Source:
LOAD *
Where MonthYear = text(Date(Today(), 'MMM-YY'));

LOAD MonthYear,
     Date#(Date, 'MM/DD/YYYY') as Date
FROM
[H:\QVDATA.xlsx]
(ooxml, embedded labels, table is Sheet1);


LET vLoad_Date = Date(Peek('Date', 0, 'Source'));

if Match(vLoad_Date, Today()) then
       TRACE 'True Section';
      
       load
              RowNo() as ID
       AutoGenerate num(month(vLoad_Date));
      
ELSE
       TRACE 'False Section';    
ENDIF

siva_boggarapu
Creator II
Creator II
Author