Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
SMalli
Contributor III
Contributor III

Replace Strings starting between 'A and W'

I've a field that has over  2 k unique email ids.

 

For the sake of testing, I want to replace email ids with couple of email ids that  I have

 

Ex: emails starting  with letters AB,......W should be replace with Jon.doe, emails starting with x...Z to be replaced with jane so on.

 

I know we can use if condition for implementing the above, I was looking for a function , like the range function in python

 

Does qlik have a function that can pick a range between alphabets ?

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel

If(eMail precedes 'X', 'Jon.Doe', 'Jane.Doe')

View solution in original post

6 Replies
Vegar
MVP
MVP

I'm not aware of such a function. However,  I am sure it could  be possible to construct such a feature.

Maybe a combination of the ord() function in  an interval match could be key words pointing  you in one doable direction. 

another approach is not to do text "intervals" but instead  wildchars. Then you could do an wildmatch() function or the qlikview component for wildchar mapping: SUB Qvc.CreateWildMapExpression.  https://github.com/RobWunderlich/Qlikview-Components/

sidhiq91
Specialist II
Specialist II

@SMalli Could you please give us sample data and I will try to figure some solution for it.

oskartoivonen
Partner - Contributor III
Partner - Contributor III

An inline mapping table is easy to maintain and modify in script for testing purposes.

 

Test_Map:
MAPPING LOAD * INLINE [
	Key, Value
	A, John
	B, John
	C, John
	D, John
	E, Jane
	F, Jane
	G, Jane
	H, Jane
];

Test:
LOAD
	ApplyMap('Test_Map', Left(Email, 1), Null()) as JohnJane
FROM
	Table.qvd (qvd);

 

MarcoWedel

If(eMail precedes 'X', 'Jon.Doe', 'Jane.Doe')
Vegar
MVP
MVP

@MarcoWedelI was not thinking of the precedes nor follows operator, but those will surely do the trick 👍

 

SMalli
Contributor III
Contributor III
Author

Thank y0u Vegar and Marco !, appreciate the help.