Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Mid/Index function

Hi,

I'm struggling with an expression in which I want to trim and only bring in certain text from a field.

For example, I have : The Dog Walked into the room. I only want to bring in 'Walked into the room'

Any help would be appreciated!

Thanks.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


saffatwist wrote:
Basically, I'd like to return all the text to the right of the end of 'The Dog '
So, if the text is 'The Dog jumped into the pool', I always want to return all text to the right of 'The Dog '. ie. 'jumped into the pool'


TextBetween(Field, 'The Dog', '')

-Rob

View solution in original post

7 Replies
gandalfgray
Specialist II
Specialist II

I think you need to better specify for us what you want to do.

For your specified example you could use:

Right(text,20)

Not applicable
Author

Basically, I'd like to return all the text to the right of the end of 'The Dog '

So, if the text is 'The Dog jumped into the pool', I always want to return all text to the right of 'The Dog '. ie. 'jumped into the pool'

I hope this is more clear.

Thanks

nicolett_yuri
Partner Ambassador/MVP
Partner Ambassador/MVP

Example:

LOAD * INLINE [

F1

The Dog jumped into the pool

The Dog Walked into the room

];



subfield(F1,'The Dog',-1)

Not applicable
Author

I think something like this!!!!!

RIGHT('The Dog jumped into the pool' , index( 'The Dog jumped into the pool', 'The Dog' ) + len(The Dog))

Not applicable
Author

index( 'The Dog jumped into the pool', 'The Dog' ) - First you find the start position....

Len('The Dog') - Second you find size of what you whant remove

ADD two expression to find where you start in the right function

and after you get a phrase without The Dog!!!!

johnw
Champion III
Champion III

Field = 'The Dog walked into the room. The Dog did something else.'

mid(Field,len('The Dog ')) = 'walked into the room. The Dog did something else.'
subfield(Field,'The Dog ',2) = 'walked into the room. '
subfield(Field,'The Dog ',-1) = 'did something else.'

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


saffatwist wrote:
Basically, I'd like to return all the text to the right of the end of 'The Dog '
So, if the text is 'The Dog jumped into the pool', I always want to return all text to the right of 'The Dog '. ie. 'jumped into the pool'


TextBetween(Field, 'The Dog', '')

-Rob