Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How do I use keep the middle string and nothing else?

I have a strong of information that looks like:

ON-1055661-1

I want the middle string in order to connect to another database that uses only that part of the data, but I can't figure out how to remove it consistently, since the first and last string can vary greatly. (Not by the number of characters in each, but with what the characters are).

I tried using subfield '-' so that it looked at each string independently, but there is so much clutter now.

1 Solution

Accepted Solutions

Re: How do I use keep the middle string and nothing else?

Subfield(yourfieldname, '-', 2) will extract the string within the dashes.

4 Replies

Re: How do I use keep the middle string and nothing else?

Subfield(yourfieldname, '-', 2) will extract the string within the dashes.

Re: How do I use keep the middle string and nothing else?

So all the records within this field will have a similar structure? xxxx-xxxx-xxxx (with xx can vary in number?) If this is the case then Subfield should work for you. If not, then is there any kind of symmetry among the records?

Best,

S

MVP
MVP

Re: How do I use keep the middle string and nothing else?

Hi,

If all the values are in the same format then you can use

SubField(FieldName, '-', 2)

OR You can also try

TextBetween(FieldName, '-', '-')

Regards,

Jagan.

Not applicable

Re: How do I use keep the middle string and nothing else?

Thanks everyone who answered, the first answer did the trick!

Community Browser