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

Date formatting variable load script


Hello, I have this script below. You can see the vFileSuffix is setting the dataformat as YYYYMMDD. But when it saves, it is saving like this: DOLLAR_A_DAILY_LOGS_572080329.QVD. The vDate for example is 20200922, but the vFileSuffix is 572080329.  I want the file to be stored as DOLLAR_A_DAILY_LOGS_20200922.QVD

 

FOR Each vDate in $(vDateList)

Let vFileSuffix = Date('$(vDate)','YYYYMMDD');

Data:
LOAD *;
SQL SELECT *
FROM HIVE.table.`fact_table`
Where $(vWhereStatement);

Store Data into [$(vQVDFiles)\UAPI_HOURLY_LOGS_$(vFileSuffix).QVD] (QVD);
Drop Table Data;

NEXT vDate;

 

I have tried changing the Let vFileSuffix = Date('$(vDate)','YYYYMMDD'); to Let vFileSuffix = Date('$(vDate)','YYYY-MM-DD');, still didn't work. 

I had first tried no formatting since the vDate comes in like vDate 20200922 (this is copied from debugging) like this vFileSuffix = Date('$(vDate).  That didn't work either

Please help

Labels (3)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@mp802377  try this ?

FOR Each vDate in $(vDateList)

Let vFileSuffix = Date#('$(vDate)','YYYYMMDD');

Data:
LOAD *;
SQL SELECT *
FROM HIVE.table.`fact_table`
Where $(vWhereStatement);

Store Data into [$(vQVDFiles)\UAPI_HOURLY_LOGS_$(vFileSuffix).QVD] (QVD);
Drop Table Data;

NEXT vDate;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

@mp802377  try this ?

FOR Each vDate in $(vDateList)

Let vFileSuffix = Date#('$(vDate)','YYYYMMDD');

Data:
LOAD *;
SQL SELECT *
FROM HIVE.table.`fact_table`
Where $(vWhereStatement);

Store Data into [$(vQVDFiles)\UAPI_HOURLY_LOGS_$(vFileSuffix).QVD] (QVD);
Drop Table Data;

NEXT vDate;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
mp802377
Creator II
Creator II
Author

Oh my word. I can't believe I missed the #. Thank you!

Martha