Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Convert variable to numeric value

Morning everybody,

Simple one for you I have a variable vWKEND that I what to make numeric.

    LET vWKEND  = peek('WEDAT', 0, 'CurrentDate');

I need to make vWKEND numeric....not too sure about the syntax to do this.

I tried this one with no luck:  

     Num('$(vWKEND)') as NumWkend;

Thanks

1 Solution

Accepted Solutions
neelamsaroha157
Specialist II
Specialist II

Or LET vWkNo  = Num(peek('WKNO', 0, 'CurrentDate'));

View solution in original post

8 Replies
Anonymous
Not applicable

what Format is WEDAT?

have you tried: week($(vWKEND))

tmumaw
Specialist II
Specialist II
Author

Here is part of my script.  I thought I would try creating another variable to pass throughout the script, but for some reason it does not like my syntax....something really simple I know.

CurrentDate:
LOAD FISPD,
FISYR,
[Billing Date],
WEDAT,
WKNO
FROM (qvd)
where [Billing Date] = '$(vToday)';

LET vFisYr  = peek('FISYR', 0, 'CurrentDate');
LET vFisPd  = peek('FISPD', 0, 'CurrentDate');
LET vWkNo  = peek('WKNO', 0, 'CurrentDate');
LET vWKEND  = peek('WEDAT', 0, 'CurrentDate');

Num(Date(
$(vWKEND), 'YYYY-MM-DD')) AS vNumWkend;

DROP TABLE CurrentDate;

Not applicable

Any of the below statement should work.

LET vWKEND  = Evaluate(peek('WEDAT', 0, 'CurrentDate'));

LET vWKEND  = Num(peek('WEDAT', 0, 'CurrentDate'));

Anonymous
Not applicable

try

Num(Date('$(vWKEND)', 'YYYY-MM-DD')) AS vNumWkend;  

what Format is WEDAT?

neelamsaroha157
Specialist II
Specialist II

Or LET vWkNo  = Num(peek('WKNO', 0, 'CurrentDate'));

tmumaw
Specialist II
Specialist II
Author

I am getting an error unknown statement

tmumaw
Specialist II
Specialist II
Author

Thanks.....

Anonymous
Not applicable

sorry, I didnot read exactly

you cannot assign a variable to other variable using as!

you should use

Let vNumWkend=Num(Date('$(vWKEND)', 'YYYY-MM-DD'))

or you directly use

Let vNumWkend=Num(Date(peek('WEDAT', 0, 'CurrentDate'), 'YYYY-MM-DD'))