Skip to main content
Announcements
Meet the 2024 Qlik Luminaries and Partner Ambassadors! READ ON!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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

View solution in original post

6 Replies
tresesco
MVP
MVP

Hi,

i think DATE function would help you. Can you upload sample application?

Regards,  tresesco

swuehl
MVP
MVP

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

Not applicable
Author

Nope date function didnt work.

Attached please find the sample. I would appreciate any help.

Thanks

swuehl
MVP
MVP

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

tresesco
MVP
MVP

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

Not applicable
Author

Thanks guys single quotation mark around the variable worked!

thanks again guys.