Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting a variable length string from field.

G'day all,

Trying to come up with a way to extract a variable length string from a field.  They are always defined within '<>'.

Example;

<VOICE> Issues w....

<MBK> can't...

<OTHER> unable to...

These are always located at the start of the string.  Just need to extract content from between '<>'.  Any ideas.

thanks

Jason

1 Solution

Accepted Solutions
6 Replies
sunny_talwar

May be use Text between function here:

TextBetween(Example, '<', '>') to extract the stuff between <...>. Check out the sample below

Table:

LOAD *,

  TextBetween(Example, '<', '>') as Requirement,

  Len(TextBetween(Example, '<', '>')) as Len,

  Len(TextBetween(Example, '<', '>')) + 2 as [Len_Inc_<>];

LOAD * Inline [

Example

<VOICE> Issues w....

<MBK> can't...

<OTHER> unable to...

];

Capture.PNG

Kushal_Chawda

If accidentally you get the Data like <VOICE> Issues.. <something> then TextBetween(YourField, '<', '>') will give you the wrong result, so use the below logic which will always pick the values from first string


TextBetween(YourField, '<', '>',1) as TextBetween,


len(TextBetween(YourField, '<', '>',1)) as Len_TextBetween


sunny_talwar

Kush I think by default it is 1. Check the attached image

Capture.PNG

sunny_talwar

Also check out the help section:

TextBetween ‒ QlikView

Capture.PNG

Not applicable
Author

Thanks to both Sunny and Kushal.  This worked a treat.

You learn something every day.  Wasn't even aware this command existed!!

thanks again.

Jason.

Not applicable
Author

first you have to assign TextBetween(Example, '<', '>') to extract the stuff between <...>.
<HAMMER> Issues.. <ANYTHING> then TextBetween(YourField, '<', '>') and  https://goo.gl/fJU04B   <HAMMER> Issues w....
<MBK>
<OTHER>