Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
wally_walton
Contributor II
Contributor II

If string contains specific characters then remove them

Hello,

I need help with the most efficient expression to achieve the following. I have a text field that contains the following example text:

.......
LIMIT PRICE (0.0015) DOES NOT MATCH TICK SIZE
LIMIT PRICE (0.0045) DOES NOT MATCH TICK SIZE
LIMIT PRICE (0.035) DOES NOT MATCH TICK SIZE
LIMIT PRICE (0.101) DOES NOT MATCH TICK SIZE
LIMIT PRICE (0.0001) DOES NOT MATCH TICK SIZE
........

I would like to create an expression: IF text contains the words "LIMIT PRICE" then remove the "(#.###)" from the string so it displays LIMIT PRICE DOES NOT MATCH TICK SIZE.

Thanks in advance

Andrew

 

 

 

1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi Andrew,

Use this, I've named your example Row, so fill in your own field name for Row:

IF(Wildmatch(Row,'*LIMIT PRICE*'),'LIMIT PRICE DOES NOT MATCH TICK SIZE',Row) as Test,

Jordy

Climber

Work smarter, not harder

View solution in original post

6 Replies
JordyWegman
Partner - Master
Partner - Master

Hi Andrew,

Use this, I've named your example Row, so fill in your own field name for Row:

IF(Wildmatch(Row,'*LIMIT PRICE*'),'LIMIT PRICE DOES NOT MATCH TICK SIZE',Row) as Test,

Jordy

Climber

Work smarter, not harder
Sameer9585
Creator II
Creator II

Try this?

keepchar ( 'field_name','abcdefghijklmnopqrstuvwxyz' ) 

Sameer9585
Creator II
Creator II

OR try this ?

keepchar(field_name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ')

JordyWegman
Partner - Master
Partner - Master

But if you do that Sameer, also when there are numbers that should be in the row are now deleted. A thing that he probably doesn't want to happen..

Jordy

Climber

Work smarter, not harder
Sameer9585
Creator II
Creator II

Hey @JordyWegman ,

But according to the problem statement this works fine and it is an efficient solution.So I think it is a better solution.

 

With Regards,

Sameer

wally_walton
Contributor II
Contributor II
Author

This is exactly what I was after. Thanks very much and appreciate the quick reply.