Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date format conversion in variable

Hi All,

I'm having issue when I set variable($p) in date. I want to read file for today's date and store into 1 QVD file.:

vToday = Date(Today(), 'DD-MM-YYYY');

//vToday=14-03-2016


LET p = $(vToday);

//p=-2005

Tmp_Table:

LOAD *

FROM

[..\..\FileName_$(p).xls]

STORE Tmp_Table into ..\..\_$(p).QVD;

DROP Table Tmp_Table;


I able to get vToday value, but when I call the variable in p I get the value as '-2005'. How can I solve this P value.

Thanks a lot !

1 Solution

Accepted Solutions
engishfaque
Specialist III
Specialist III

Dear Syashairi,

Kindly find attached App, for quick reference script is given below.

--

LET vToday = Date(Today(), 'DD-MM-YYYY');

LET p = '$(vToday)';

Table1:

LOAD Product,

    Sales

FROM

[Sales_$(p).xlsx]

(ooxml, embedded labels, table is Sheet1);

STORE Table1 into $(p).qvd;

DROP Table Table1;

Kind regards,

Ishfaque Ahamed

View solution in original post

4 Replies
sunny_talwar

Try this may be:

May be try this:

vToday = Date(Today(), 'DD-MMM-YYYY');

//vToday=14-Mar-2016


LET p = $(vToday);

//p=-2005

Tmp_Table:

LOAD *

FROM

[..\..\FileName_$(p).xls]

STORE Tmp_Table into ..\..\_$(p).QVD;

DROP Table Tmp_Table;

Not applicable
Author

Dear Sunny,

I get this error :

Cannot open file 'D:\..\FileName_.xls' The system cannot find the file specified.

Forgot to mention my filename is File_DD-MM-YYYY.

engishfaque
Specialist III
Specialist III

Dear Syashairi,

Kindly find attached App, for quick reference script is given below.

--

LET vToday = Date(Today(), 'DD-MM-YYYY');

LET p = '$(vToday)';

Table1:

LOAD Product,

    Sales

FROM

[Sales_$(p).xlsx]

(ooxml, embedded labels, table is Sheet1);

STORE Table1 into $(p).qvd;

DROP Table Table1;

Kind regards,

Ishfaque Ahamed

Not applicable
Author

Hi Ishfaque,


It works, Thanks so much!