Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Check a character at a certain position

Greetings,

I have a table like this

Server Name
rect4156ezr

rect9685erz

azed1562aze
deer4567ezz

And i want to filter to get only those who have an e at the 9th position on their name, i tried with index("Server Name" ,'e')=9 but i doesn't work if e is present multiple times.

Thanks for answers!

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

The Index function will not always work in the way you have been thinking. Mid() function is a better and more efficient approach.

Mid("Server Name",9,1) = 'e')

This will do a direct check of the character at the ninth postion without doing a search. Index like you have used will not match on a server name that have one or more 'e' characters before the ninth position even if the ninth character is an 'e'.

Are you doing this in your load script or in a sheet in a visualization table?

If in the load script it would be:

LOAD

    ....

WHERE

    Mid("Server Name",9,1)='e';

If in a visualization table you do it - depends on which dimensions you have - but making a dimension that only includes the server names that have e in the 9th position would be an option:

=If( Mid("Server Name",9,1)='e', "Server Name")

View solution in original post

2 Replies
petter
Partner - Champion III
Partner - Champion III

The Index function will not always work in the way you have been thinking. Mid() function is a better and more efficient approach.

Mid("Server Name",9,1) = 'e')

This will do a direct check of the character at the ninth postion without doing a search. Index like you have used will not match on a server name that have one or more 'e' characters before the ninth position even if the ninth character is an 'e'.

Are you doing this in your load script or in a sheet in a visualization table?

If in the load script it would be:

LOAD

    ....

WHERE

    Mid("Server Name",9,1)='e';

If in a visualization table you do it - depends on which dimensions you have - but making a dimension that only includes the server names that have e in the 9th position would be an option:

=If( Mid("Server Name",9,1)='e', "Server Name")

Anonymous
Not applicable
Author

That did the trick!

Thanks Petter i may not had understanded index() correctly but now i do!