Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
antonaks
Creator II
Creator II

Text parsing for timestamp

Hi colleagues.

I have string field with time stamp and some text.

For example:

 

21/06/2018 2:17: 6718                    call Step_11
21/06/2018 2:59: 2461                  call Step_12
21/06/2018 2:59: 2463                  CALL Step1
21/06/2018 2:59: 6502                    call Step_22
21/06/2018 2:59: 6503                    call Step_23
21/06/2018 2:59: 6504                    call Step_23
21/06/2018 3:00: 2464                  CALL Step2

I what get timestamp, but don't wan't use Left() function, or something like that. I want use only timestamp#() if it possible.

Can you help me?

1 Solution

Accepted Solutions
sunny_talwar

Awesome, please close the thread if you got what you wanted.

Best,

Sunny

View solution in original post

8 Replies
sunny_talwar

TimeStamp and Text are in the same column or are they two different columns?

antonaks
Creator II
Creator II
Author

All In one column.

sunny_talwar

In that case, you need to separate out TimeStamp from the whole string before you can use TimeStamp#() function. You didn't want to use Left() function, but how about SubField to separate text from timestamp?

antonaks
Creator II
Creator II
Author

I will try.

I thought we can use timestamp# with format like 'MM/DD/YYYY hh:mm####' to cut redundant text.

sunny_talwar

I don't think that is possible (atleast based on my understand)... you can help interpret an exact timestamp (not read as timestamp), but it cannot remove any untended text.

sunny_talwar

This works... if you are okay with using SubField

Table:

LOAD *,

TimeStamp(TimeStamp#(SubField(FieldName, '  ', 1), 'DD/MM/YYYY h:mm: ffff')) as TimeStamp;

LOAD * INLINE [

    FieldName

    21/06/2018 2:17: 6718                    call Step_11

    21/06/2018 2:59: 2461                  call Step_12

    21/06/2018 2:59: 2463                  CALL Step1

    21/06/2018 2:59: 6502                    call Step_22

    21/06/2018 2:59: 6503                    call Step_23

    21/06/2018 2:59: 6504                    call Step_23

    21/06/2018 3:00: 2464                  CALL Step2

];

antonaks
Creator II
Creator II
Author

Yes it works, thank you.

sunny_talwar

Awesome, please close the thread if you got what you wanted.

Best,

Sunny