Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
MEDHA07
Contributor III
Contributor III

How to load data from SQL YTD to Maxdate in qlik script

Hi All,

 

I need to implement the incremental load in my app to insert the records every day based on maximum date.

initially  i need to load only 01-jan-21 to 19-May-21 and store into qvd,then i will use maximum date from stored qvd and it has 19-May21.then i will store the value into variable and next time whenever i run will use this variable for inserting records from20-May21 to 01-jan-21 to 19-May-21 qvd using concatenate.

Probelm:As i mentioned my source has data from 2015 to2021 may.so i need to write the filter in sql query load data from 

01-jan-21 to 19-May-21 ,i have tried  below but it is not working.

LET vMaxDate1 = date(peek('Maxdate'),'DD-MMM-YY');(19-May-21)

let YTD= date(yearstart(today()),'DD-MMM-YY');

source:

select * from table

Where To_Char(LST_UPDT_TS, 'DD-MON-YY') >='>=date(yearstart(today()),'DD-MMM-YY') <=$(vMaxDate1)'

/*'>=$(YTD) <=$(vMaxDate1)'

1 Solution

Accepted Solutions
MayilVahanan

Hi HarishM07 

I think, you are connecting oracle database, if so, try like below

Where To_Char(LST_UPDT_TS, 'DD-MON-YY') BETWEEN date '$(YTD)' AND date '$(vMaxDate1)'


 ref: https://www.oracletutorial.com/oracle-date-functions/oracle-to_char/

 

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

View solution in original post

1 Reply
MayilVahanan

Hi HarishM07 

I think, you are connecting oracle database, if so, try like below

Where To_Char(LST_UPDT_TS, 'DD-MON-YY') BETWEEN date '$(YTD)' AND date '$(vMaxDate1)'


 ref: https://www.oracletutorial.com/oracle-date-functions/oracle-to_char/

 

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