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

How to search in a field?

Hello,

I'm new in QV.

I have one question : how we do search a  string in a field? (but not in the script)

For instance, i have to search the following word 'v5.'   in a field which contain 'v4.6.3' , 'v6.3.5.9' , 'v2' etc...

Don't forget, this research must be done in a text object and not in the script.

I try '=' but this doesnt work....

Thanks.

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

Then you can use the usual Count() function with a set analysis like in the attached application. You can use a variable to populate the set modifier.

Hope that helps.

Miguel

View solution in original post

9 Replies
goldnejea8
Partner - Creator
Partner - Creator

1)  Are you sure there is a 'v5' in the data to begin with?  Try using the same logic on other ones you know is there.

2)  Make sure you are quoting the search term with single quotes eg. Field='Value'

3)  What is your code for the text object?  What is your end goal?  If you are just trying to select 'v5' in a listbox, there is built in search functionality on the list box that you can customize as well.

Miguel_Angel_Baeyens

Hi,

What about using WildMatch()? If the function returns different than zero, then there is a match, if it returns a zero, there is not a match.

=WildMatch(FieldName, 'v5.*')

Hope that helps.

Miguel

Alexander_Thor
Employee
Employee

=sum(substringcount(YourField,'v5'))

I would however suggest you do flag this with numeric values in your data model. String manupilation is single threaded operations so if you expect large number of users it's vise to move the calculation into the script and just do sum(YourFlagField)

Not applicable
Author

Thanks you all for yours answers.

My goal is to count how many 'v5.'

And Yes 'v5'  exists  in the field.

But i need a dashboard so i can't use the search functionnality in the listbox.

WildMatch is good but i think not enough to realise what i want:

i try this but the result is not good:

=sum( distinct if ( WildMatch(FieldName,' v5.* ')=0 ,0 ,1))

Another idea?

Thanks

Alexander_Thor
Employee
Employee

Yes, =sum(substringcount(YourField,'v5'))

example.PNG

Not applicable
Author

Thanks Alexander,

But if your example is : A

                                  v5

                                  v5.

                                  v5.6 

                                  v6

I want to know how many occurence of 'v5.' there is ,not the number of rows that contain 'v5'....

So the number i wanna see is 2  ( v5. & v5.6 ).

Many you have another solution for me?

Not applicable
Author

Thanks Miguel,

A question with WildMatch:

If the search is dynamic for example january i wanna search for 'v.1' and february i wanna 'v.2' etc..

can we use it in Wildmatch?

Ps: i want to use

=MixMatch (Month, 'janv.' , 'févr.' , 'mars' , 'avr.' , 'mai' , 'juin' , 'juil.' ,'août' , 'sept.' ,'oct.' , 'nov.' , 'déc.' )

Miguel_Angel_Baeyens

Hi,

Then you can use the usual Count() function with a set analysis like in the attached application. You can use a variable to populate the set modifier.

Hope that helps.

Miguel

Not applicable
Author

Thx,

This is perfect.