Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Removing the delimiters from the field

Hi All,

             I am trying to remove the delimiter(-) from my one of the column, If my column contains values like

HYN 2500 - large cab,

Svera 1800 - large cab

R - 250 - large cab.

   From the above fields i want remove the large cab means right side part i want kepp the left side part only for the above fileds i have removed left part after the delimiter ( - ) from 2 fileds using index function result is

HYN 2500

Svera 1800

R

But in the last field i want the filed R-250 here after the second delimiter the test should be wiped out. I ahve tried multiple ways but not getting correct logic. can any one help on this. Please find the attached sample app.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try this expression:

=iF(index(Name,'-'),Mid(Name,1,Index(Name, '-', -1)-2),Name)

View solution in original post

5 Replies
Not applicable
Author

Subfield(Name,'-',1) will help you achieve that

Anonymous
Not applicable
Author

try this

=index('R-250 - Large', '-', -1)

will find the first "-" from right

tresesco
MVP
MVP

Try this expression:

=iF(index(Name,'-'),Mid(Name,1,Index(Name, '-', -1)-2),Name)

Not applicable
Author

Hi tresesco,

                Thanks for your quick replay, it worked perfectly. Could you please explain the expression am not able to understand it, how it is doing der...

tresesco
MVP
MVP

Index(Name, '-', -1) => gets the position of the last '-' in the string  // '-1' indicates to find the first occurance of the character starting from the end. IF statement is used to get the field Name in it's entirety when there is no '-', otherwise remove the part from last occurance of '-'.