Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
uba_ha
Contributor II
Contributor II

Pick up specific date from a string

Hello experts, I am new to Qlik and I am trying to pick up some useful information (date) from a string ([Invoice Code]), which looks something like "Connecticut (SAP) - Connecticut Ltd - 4200001444 - WE 06/05/2018 - INV 06/05/2018". 

All I want is getting the date of the "WE", i.e.  "06/05/2018" from the above (not the date after "INV").

I used PurgeChar(Upper([Invoice Code]),'ABCDEFGHIJKLMNOPQRSTUVXYZ') to get rid of the characters except "W".

I then used

MID(PurgeChar(Upper([Invoice Code]),'ABCDEFGHIJKLMNOPQRSTUVXYZ-'),FindOneOf('W',PurgeChar(Upper([Invoice Code]),'ABCDEFGHIJKLMNOPQRSTUVXYZ-'),10)+3,10)

to find the location number of "W" and from that fetch the next 10 characters but the output is ") 4200".

I have attached the qvw. 

Any ideas would be grateful. Many thanks.

Labels (2)
1 Solution

Accepted Solutions
trdandamudi
Master II
Master II

One more way to do this is:

= Mid( [Invoice Code],Index ( [Invoice Code], 'WE ' )+3 ,10)

and it will give you the date after 'WE '. Hope this helps.

 

View solution in original post

3 Replies
m_woolf
Master II
Master II

date(textbetween([Invoice Code],' WE ',' - ') as YourFieldName

trdandamudi
Master II
Master II

One more way to do this is:

= Mid( [Invoice Code],Index ( [Invoice Code], 'WE ' )+3 ,10)

and it will give you the date after 'WE '. Hope this helps.

 

uba_ha
Contributor II
Contributor II
Author

Many thanks for all your help!