Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

subfield

Hi all,

How can extract the date only ?

Exemple in my script :

LOAD Field FROM File;

Where Field = date=2013-01-31 Time=17:09:45 ip=192.122.123.13.11

I tried: (Field,index(Field,'=')+1) as Date but It doesn't work. I just want to obtain the date.

How can I get the string before thie operator " = " ? (dynamicallly).

I would like to get

LOAD

Field 1 as Date

Field 2 as Time

Field 3 as IPAddress

FROM FILE.

Thank for your help,

3 Replies
Not applicable
Author

Hi,

Perhaps you could try the TEXTBETWEEN function

TextBetween (string, delimiter 1, delimiter 2)

where delimiter1 = "=" and delimiter2 = "TIME="

Fabrice

srchilukoori
Specialist
Specialist

use the following expressions for loading the date, time & IP

IP string: Subfield(Subfield('date=2013-01-31 Time=17:09:45 ip=192.122.123.13.11', '=', 4), ' ', 1)

Time string: Subfield(Subfield('date=2013-01-31 Time=17:09:45 ip=192.122.123.13.11', '=', 3), ' ', 1)

Date String: Subfield(Subfield('date=2013-01-31 Time=17:09:45 ip=192.122.123.13.11', '=', 2), ' ', 1)

hope this helps...

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

To get Date

=Date#(SubField(SubField('date=2013-01-31 Time=17:09:45 ip=192.122.123.13.11','Time=',1),'date=',2), 'YYYY-MM-DD')

Time

Time#(SubField(SubField('date=2013-01-31 Time=17:09:45 ip=192.122.123.13.11','ip=',1),'Time=',2), 'HH:mm:ss')

IP

SubField('date=2013-01-31 Time=17:09:45 ip=192.122.123.13.11','ip=',1)