Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using the trim function to shorten names

Hello,

I'm having a field which contains long values.

All of them start with an amount of tags that I want to remove since I do not want to see them in the report.

The length and the tags are always different.

All they have in common is that they end with "] " before the actual value that I need to see starts.

I never used the trim function and I'm wondering if it's somehow possible to say:

remove everything before and including "] " and display the rest only.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

another option could be (in script or in chart)

Right(field, len(field) - index(field, '['))

View solution in original post

6 Replies
Colin-Albert

Subfield(yourfieldname, ']', 2)

maxgro
MVP
MVP

another option could be (in script or in chart)

Right(field, len(field) - index(field, '['))

Anonymous
Not applicable
Author

had to add a space and use the closing brackets.. after that it worked. thanks Massimo.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The subfield() function can take a negative index, which counts from the right. (It's not clear in the doc). That's convenient for handling a variable number of delimiters.

=Subfield(yourfieldname, ']', -1)


So


=SubField('[tag1][tag2]mydata',']',-1) = 'mydata'


-Rob

http://masterssummit.com

http://robwunderlich.com



MarcoWedel

another one:

Mid(Field, Index(Field, '] ')+2)

just because QlikView offers so many possibilities;-)

regards

Marco

MarcoWedel

Or

TextBetween(Field&'@','] ','@')

Although I find the already proposed subfield() solutions most intuitive.

regards

Marco