Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

make date

How can you make date from a following field

PerformanceLog_201103206565656565.tmp

How do you extract:  20110320  as date from above in (YYYYMMDD) format.

Thanks

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Hanns,

You can also try,

Date(Date#(left(Subfield('Field', '_',2),8),'YYYYMMDD'),'YYYYMMDD') as Date

View solution in original post

6 Replies
Anil_Babu_Samineni

How about this:

LOAD *,

Date#(KeepChar(Field,'0123'),'YYYYMMDD') as Field1

INLINE [

Field

PerformanceLog_201103206565656565.tmp

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this.

Load *,Date(Date#(Mid(Data,Index(Data,'_')+1,8),'YYYYMMDD')) as DATE inline [

Data

PerformanceLog_201103206565656565.tmp

];

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anil_Babu_Samineni

Kaushik, How about This?

LOAD *,

mid(Field,16, 8 ) as Field1

INLINE [

Field

PerformanceLog_201103206565656565.tmp

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tamilarasu
Champion
Champion

Hi Hanns,

You can also try,

Date(Date#(left(Subfield('Field', '_',2),8),'YYYYMMDD'),'YYYYMMDD') as Date

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Anil,

The expression is right, however whenever the text character changes, the script you wrote will fail.

So it is important to get the dynamic value. Have a look at the expression I gave, which is dynamic in nature.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
MarcoWedel

Hi,

another solution could be:

QlikCommunity_Thread_230663_Pic1.JPG

table1:

LOAD *,

    Date#(Left(SubField(filename,'_',-1),8),'YYYYMMDD') as date

INLINE [

    filename

    PerformanceLog_201103206565656565.tmp

    PerfLog_201204216565656565.tmp

    Performance_Log_201305226565656565.tmp

];

hope this helps

regards

Marco