Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Parse out text between two identifiers

Hi,

I'm having a little bit of an issue parsing out text found in between two identifiers (strings)

What I am trying to accomplish is below - for example

I have a string field named resource and it has the following values:

|Wireless Transport|WT-ABC-1505|Process statistics

|Wireless Transport|WT-ABC-1506|Process statistics

|Wireless Transport|WT-XYZ-303556|Process statistics
|Wireless Transport|WT-XYZ-303109|Process statistics

What I want as the result is to extract the data found between |Wireless Transport| and |Process statistics|, however I do not want to include the numerical text as the result. What I would expect the result to be is as below:

WT-ABC

WT-XYZ

If anyone has any suggestions to parse out this information that would be great!

Thank you in advance.

1 Solution

Accepted Solutions

Re: Parse out text between two identifiers

Maybe left(TextBetween(MyField, '|Wireless Transport|','|Process statistics'),6)

or subfield(TextBetween(MyField, '|Wireless Transport|','|Process statistics'),'-',1) & '-' & subfield(TextBetween(MyField, '|Wireless Transport|','|Process statistics'),'-',2)


talk is cheap, supply exceeds demand
3 Replies

Re: Parse out text between two identifiers

Maybe left(TextBetween(MyField, '|Wireless Transport|','|Process statistics'),6)

or subfield(TextBetween(MyField, '|Wireless Transport|','|Process statistics'),'-',1) & '-' & subfield(TextBetween(MyField, '|Wireless Transport|','|Process statistics'),'-',2)


talk is cheap, supply exceeds demand

Re: Parse out text between two identifiers

try this:


Mid(Textbetween(resource,'|Wireless Transport|', '|Process statistics|'),6)


let me know

Not applicable

Re: Parse out text between two identifiers

Hi Gysbert,

Thank you for the response.

That solution works but the number of characters is not static throughout the field.

The result may not always be 6 characters. Do you happen to have any ideas dealing with a dynamic number of characters returned?

*EDIT*

The subfield suggestion worked like a charm!! Thanks much!

Community Browser