Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

Please help me on preceding load

Hi,

I am facing a problem for the below code:

[Data]:

load FILE_ID,

Timestamp(Timestamp#(UNPACKAGED_DATE_TIME,'DD-MMM-YY hh:mm:ss.fff TT'),'MM/DD/YYYY h:mm:ss[.fff] TT') as UNPACKAGED_DATE_TIME;

select FILE_ID, UNPACKAGED_DATE_TIME

from edi_e2e_user.abc_e2e_tracking_record where FILE_ID = 'ci1534054081616.19521239@sbycsaxy05_te';

when I execute the above code, I got nothing for UNPACKAGED_DATE_TIME, but when I hard coding date as

Timestamp(Timestamp#('11-AUG-18 08:38:01.000000000 PM','DD-MMM-YY hh:mm:ss.fff TT'),'MM/DD/YYYY h:mm:ss[.fff] TT') as UNPACKAGED_DATE_TIME

the data is coming well. Please suggest what should I do now.

Tags (1)
1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Re: Please help me on preceding load

I just tried a few localization-strings and it seems that some don't work especially those ones which contain not only letters like () or - and I would consider it as a bug (either by parsing the strings or within the documentation). But using the following worked for me:

ConvertToLocalTime(UNPACKAGED_DATE_TIME, 'GMT-09:30')

Beside this your date() formatting will just show the values as date but they remain a timestamp. If you want to get a date you need something like this:

date(floor(YourTimestamp)) as Date

respectively

time(frac(YourTimestamp)) as Time

to get the time. Quite often it's useful to split timestamps in this way to reduce the number of distinct values of a field.

- Marcus

View solution in original post

18 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Please help me on preceding load

I seems that the timestamp-format from UNPACKAGED_DATE_TIME is a bit different to your expectation and therefore the timestamp#() conversion fails. Just comment the preceeding part to load the data without any transformation and then put UNPACKAGED_DATE_TIME within a tablebox to look for the real values and if there is no differences visible maybe to export/copy them into excel and/or an editor like notepad ++ to identify each single char.

- Marcus

Highlighted
MVP
MVP

Re: Please help me on preceding load

That probably means your timestamp format is not matching. What is your data source? How does it look if you load in qlik directly (without any formatting)? If it is already in number format, you could directly try loading like:

Timestamp(UNPACKAGED_DATE_TIME, 'MM/DD/YYYY h:mm:ss.fff TT') as UNPACKAGED_DATE_TIME;

Highlighted
Creator III
Creator III

Re: Please help me on preceding load

Hi,

The value for that field is:

'11-AUG-18 08:38:01.000000000 PM'

but the point is when I use it in a KPI, it is showing correct value, but when I use it in a preceding load it shows nothing.

Highlighted
MVP & Luminary
MVP & Luminary

Re: Please help me on preceding load

Something between your value and your specified formatting does not match. One point could be that your specified qlik-variables for MonthNames (by default at the beginning of your script in tab Main) and/or these regional-setting of your machine are different to your values - because the available month-name abbreviation - for ...AUG... - must fit with your values to be matchable.

Further you need to know exactly which chars are in your values - each additionally space or maybe a tab instead of a space or something similar will break the conversion. Therefore try my suggestion from above.

- Marcus

Highlighted
Creator III
Creator III

Re: Please help me on preceding load

Hi,

My data source is Oracle and Datatype is Timestamp.

My value at oracle field is: '11-AUG-18 08:38:01.000000000 PM'

When I use your expression the value is changed to: 12-08-2018  06:08:01 AM.

It is noted that I am using the below expression:

Timestamp(UNPACKAGED_DATE_TIME, 'MM/DD/YYYY h:mm:ss.fff TT') as UNPACKAGED_DATE_TIME

Please advise what should I do now?

Highlighted
Creator III
Creator III

Re: Please help me on preceding load

HI,

Please help me.I have replied already.

Highlighted
MVP & Luminary
MVP & Luminary

Re: Please help me on preceding load

I think this means that your values are already numerical timestamps and no strings because the timestamp() formatting doesn't returned NULL. Your noticed differences between origin and formatted value is caused through different timezones. For this you could try to adjust it with converttolocaltime() or with a manually adjusting with something like:

Timestamp(UNPACKAGED_DATE_TIME - (1/24*9.5), 'MM/DD/YYYY h:mm:ss.fff TT')

- Marcus

Highlighted
Creator III
Creator III

Re: Please help me on preceding load

Hi,

I have used the below code , but is showing 12th August 2018,

convertToLocalTime(UNPACKAGED_DATE_TIME, 'Eastern Time (US & Canada)') as DATE_TRAN

but the below code is working fine:

Date(Timestamp(UNPACKAGED_DATE_TIME - (1/24*9.5)), 'MM/DD/YYYY h:mm:ss.fff TT') as UNPACKAGED_DATE_TIME

So please advise me if my client's time zone format is: Eastern Time (US & Canada), then what will be the better option?

Highlighted
MVP & Luminary
MVP & Luminary

Re: Please help me on preceding load

It seems that your timezone-string isn't correct and missed an A by US and also the spelling of the first char of Canada seems to be a K (at least within the german help it looked in this way):

convertToLocalTime(UNPACKAGED_DATE_TIME, 'Eastern Time (USA & Kanada)')

- Marcus