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: 
Not applicable

How could I search a '*' in a Listbox

Hi,

I have a textfield in my applikation where some data values containing an '*' (Asterisk). How could I search all values with this character in it in a Listbox?

Thanks for Help

Alex

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

i´ve got two suggestions. You can use a macro


sub Select_Asterisk
ActiveDocument.Fields("Feld").Clear
ActiveDocument.Fields("Feld").Select "?*?"
ActiveDocument.Fields("Feld").ToggleSelect "*"
end sub


or following string for searching


= Feld = '*' or Feld like '?*?'


Kind regards.

View solution in original post

10 Replies
Not applicable
Author

Are you talking about searching within a listbox (F3)?

I did a quick test by adding an asterisk into my data using an Inline Load. Then I tried searching on the listbox and it automatically gives you two asterisks to start your search. When I removed one, it seemed to only select the asterisk was selected. If you have only one asterisk in the search box, it seems like it would show all fields containing an asterisk.

Not applicable
Author

I'm assuming you have data with an asterix anywhere? (see attached). I'm not sure you can. I've tried the chr(42) but the list box doesn't accept that calc (even in advanced search).

Not applicable
Author

Hi,

thats the point I want to find all string which have a * in it. eg. "a*","*b","h*llo" (see attached). With the single asterisk you can find only the single asterisk. (Thank you NMiller).

I've found an workaround with a replace of the aterisk (also see attached) But this can't be the way to solve it!

I tried to quote it with a backslash or something else (','',/,#,...) but it doesent work. I tried the chr() funktion like rob suggested, it works with =chr(97), that finds all words with an "a" in it but with chr(42) you only find the single *.

Not applicable
Author

Hi Friends of QlikView!

I still need an answer to that question. Any suggestions?

regards Alex:)

Not applicable
Author

Hi,

i´ve got two suggestions. You can use a macro


sub Select_Asterisk
ActiveDocument.Fields("Feld").Clear
ActiveDocument.Fields("Feld").Select "?*?"
ActiveDocument.Fields("Feld").ToggleSelect "*"
end sub


or following string for searching


= Feld = '*' or Feld like '?*?'


Kind regards.

Not applicable
Author

Great!

'?*?' works!

Have Fun With QV

Alex:)

Not applicable
Author

I don't think this is a valid method. It only works in the attached example 'Suche' because all the posts including a '*' are 2 characters. And if any post without '*' existed in the table being 2 characters, they would also pass.

The method can't explicitly find strings including a '*' which are more or less than 2 characters, fx '1234*', '*1234' or '12*34'.

So we still need at method to search for '*' (asterix)

Not applicable
Author

in the search box you can just type

=index(strIn,'*')

of course you'll have to replace strIn with your actual field name.

The search string will match any record that has one or more '*' character in it. Index returns the position of the asterisk, and is evaluated as "true" if the index is >0.

=index(strIn,'*')

is actually a shorthand for

=(index(strIn,'*')>0)

Hope this helps

Hilaire

Not applicable
Author

Yep, this works!

It's however a bit uphill if you want to make a search which allso have other requireries, for instance if you want to catch strings whick allso only starts with 1 or strings like '123?4*' where ? is used as wildcard.

The index-method was however suffient for my use.