Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a table where one of the fields is called Keywords
e.g Keywords:
"good book"
"bad book"
"www.book.com"
"buy great books"
"medical Books"
"reading medical"
etc.
I would like to filter out all records where field Keywords doesn't contain word "book" (either lower case or upper case). So the expected result would be all the above keywords except "reading medical". What function do I use for it? How would the code look like?
I am a beginner with QV and coding so please help me to write the code for it.
Thanks
Heyy dszl136154,
You can use the below mnsion script:
Sum({<Keywords ={"*book*"}>} Amount)
Assuming the Amount as the Field Containing AMOUNT.
the above expression will give sum of all values where the Keywords contains the "book" .
Regards,
Nilesh Gangurde
I think I didn't explain the problem properly. There is nothing in the data what needs to be summed.
The table has 5 fields (with 200 records):
Keywords | Source | Date | Time | Group |
good book | A | 01/10/2012 | 12:15 | GOOD |
bad book | A | 02/10/2012 | 13:15 | BAD |
buy great books | A | 03/10/2012 | 14:15 | GOOD |
medical Books | B | 04/10/2012 | 15:15 | GOOD |
reading medical | B | 05/10/2012 | 16:15 | GOOD |
www.book.com | B | 06/10/2012 | 17:15 | GOOD |
I would like the code to filter out all records where field Keywords doesn't contain word "book".
So the result would look like this:
Keywords | Source | Date | Time | Group |
good book | A | 01/10/2012 | 12:15 | GOOD |
bad book | A | 02/10/2012 | 13:15 | BAD |
buy great books | A | 03/10/2012 | 14:15 | GOOD |
medical Books | B | 04/10/2012 | 15:15 | GOOD |
www.book.com | B | 06/10/2012 | 17:15 | GOOD |
Thank you.
In your script try;
If ( Keywords = '*book*' , Keywords , Null() ) as Keywords
Then in your table or chart don't display null values.
Hi, you can use wildmatch for this scenerio. Use the expression as WildMatch([Keywords], '*boo*') = 1 Find the qvw file.
Do you want to filter it in script?
if so
below query filter records contains book
Load
*
Resident
tablename
where Wildmatch(Keywords,'*book*');
Or need to be done in expression
in expressions use set analysis as {<Keywords={"*book*"}>}
Thanks Siva and Celambarasan, I love learning new functions (wildmatch) that are more efficient.
Thanks guys. I will try the solutions all of you suggested.