
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Peek function to pick a date
Hi
I am using the following line code to pick a date using peek function.
LET vDate=Peek('DateFeild',$(i),'DateTable');
And I want to use the variable vDate in LOAD statement. After execution, the table which loaded has decimal values instead of dates.
I want to get the exact dates. Its because Peek function returns a string. I am not able to figure out a way to get the date value when I use in LOAD statement.
Thanks in advance.
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using single quotation marks around the variable:
'$(vMDMTargetDate)' as vDate
The number you get is 6 divided by 17 divided by 2011 ( 6/17/2011 ), QlikView expands the variable and then tried to evaluate the expanded.
Hope this helps,
Stefan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
i think DATE function would help you. Can you upload sample application?
Regards, tresesco


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The variable holds the numerical representation of the value retrieved from the DateField, so I think this is ok.
When you recall the variable value, you could use Date() function then to format the date, like
LOAD
...
Date($(vDate)) as PeekedDate,
....
from ...
to format it with standard date format (or specify the format code string as second parameter in Date() function).
Hope this helps,
Stefan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nope date function didnt work.
Attached please find the sample. I would appreciate any help.
Thanks


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using single quotation marks around the variable:
'$(vMDMTargetDate)' as vDate
The number you get is 6 divided by 17 divided by 2011 ( 6/17/2011 ), QlikView expands the variable and then tried to evaluate the expanded.
Hope this helps,
Stefan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
it seems that your source file has timestamp for date field as in [Date of Delivery] and it is not being taken in right format for date. can sample source files(csv) be uploaded?
Regards, tresesco

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks guys single quotation mark around the variable worked!
thanks again guys.
