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: 
ajit_aarya
Contributor II
Contributor II

Exclude from wild match

Filtering with respect to specified position in the value of a field
 

I want to select only specified values in my field

 

As example 

Code

USFYKAU8I

USIKSAU9U

USKJ1SHSW

USJG5AJGU

 #########################

I want only codes which start with US and sixth letter should be A.

I tried this   =If(WildMatch(Code,'US???A???'), Code)

Exclude

I also want to eliminate letter U on ninth position

If(WildMatch(Code,'US??????U'),'Unspecified') --- condition to exclude code ends with U i guess

###########################################################################

=If(WildMatch(Code,'US???A???',If(WildMatch(Code,'US???A???','Unspecified'), Code)

Is it works 

 

I want both conditions to satisfy

Labels (2)
5 Replies
MarcoWedel

What's your expected result given your example values?

sidhiq91
Specialist II
Specialist II

@ajit_aarya  Not sure of your exact requirement. But with whatever I have understood I have created a script for you. This will include three Criteria

1. Code should start with US

2. Sixth Character should always be 'A'

3.Ninth Character should always be 'U'

Based on the above Conditions your Code will be filtered.

NoConcatenate
Temp:
Load *
where match(Condiditon,'Match');


Load *,
Right(left(Code,6),1) as Sixth_Value,
Right(left(Code,9),1) as Ninth_Value,
if(WildMatch(Code,'US*') and Right(left(Code,6),1)='A' and Right(left(Code,9),1)='U',
'Match','No match') as Condiditon;

Load * Inline [
Code
USFYKAU8I
USFYKBU8I
USIKSAU9U
USAJ1AHSW
USJG5AJGU
UKJG5AJGU
];

Exit Script;

If this does not meet your requirement as @MarcoWedel mentioned please provide some sample data and expected output. If it meets your requirement please like and accept as solution.

 

ajit_aarya
Contributor II
Contributor II
Author

expected results are codes which are starts with US and sixth Position A and also not ends with U

 

From above samples, Expected are 

 

USFYKAU8I

( It satisfies three conditions)

 

 

MarcoWedel

maybe something like 

 

MarcoWedel_0-1657057097312.png

 

table1:
Load *
Inline [
Code
USFYKAU8I
USIKSAU9U
USKJ1SHSW
USJG5AJGU
ABCDEFGHI
USCDEFGHI
ABCDEAGHI
USCDEAGHI
ABCDEFGHU
USCDEFGHU
ABCDEAGHU
USCDEAGHU
USCDEAGHIU
]
Where Code like 'US???A*' and not Code like '????????U*';

 

 

MarcoWedel

or instead

 

Where Left(Code,2)='US' and Mid(Code,6,1)='A' and Mid(Code,9,1)<>'U';

 

both checking for your initial "no U on ninth position" condition, which only is equal to "does not end with U" for codes of length 9 obviously.

 

"does not end with U" solutions in this case would be:

 

Where Code like 'US???A*' and not Code like '*U';

 

or

Where Left(Code,2)='US' and Mid(Code,6,1)='A' and Right(Code,1)<>'U';

hope this helps
Marco