Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

evansabres
Contributor III

Searching for a character

Hello -

I am working on a Qlikview app studying Twitter. What I want to do is create a list box that searches the tweets (from field ID twCONTENT) which is the the tweet itself, and produces tweets with characters such as "#" (for hashtags) and "A" (for at replies, mentions)

Please help!

Thank you,

13 Replies

Re: Searching for a character

Click on the magnifying glass icon on the top right of the listbox of the field that contains the characters you're looking for. Enter the # character to find the tweets with a # character.


talk is cheap, supply exceeds demand
evansabres
Contributor III

Re: Searching for a character

Hello

Thank you for the response. I see how to do that but I want a list box that contains only those fields with a #. Is there a way to do this in my script; such as clean the field, which is tweet text to return only those tweets with a # and rename that field Hashtag and create a list box from this new field?

Thank you again for your assistance.

Sent from my Verizon Wireless 4G LTE smartphone

Re: Searching for a character

You can load only the records where the tweet text contains a # character:

HashTagTweets:

LOAD

     ...some fields ...,

     TweetTextField as Hashtag,

     ...some more fields....

FROM

     ...some source...

WHERE

     substringcount(TweetTextField, '#')>0

;


talk is cheap, supply exceeds demand
morris70
Valued Contributor

Re: Searching for a character

You could also use  as Gysbert mentioned but use this WHERE function instead.

WHERE

TweetTextField Like '#*';

morris70
Valued Contributor

Re: Searching for a character

Or just simply use this in the table containing the TweetTextField

If (Left(TweetTextField,1) = '#', TweetTextField) As Hashtag,

evansabres
Contributor III

Re: Searching for a character

Nils -

Thanks for your response.

The name of the field that contains the tweet text is called

How would I alter your statement to include the correct field name.

I apologize for this rudimentary question, I am quite the novice user.

Cheers,

Evan Barrick

morris70
Valued Contributor

Re: Searching for a character

Hi

No problem. This is the simplest way of doing it. This requires the field to start with a hashtag, if the field contains other symbols or letters this can be handled but not with the below solution.

Ok, in the script where the field containing the tweets are loaded it will look something like this

TableName:

LOAD

     SomthingA,

     SomthingB,

     IDtwContent,

     If(Left(IDtwContent,1)='#',IDtwContent) AS Hashtag,

     SomthingC,

From

     SQL SELECT*

     SomeSource;

evansabres
Contributor III

Re: Searching for a character

Nils -

Thank you again. So in my scenario, I am searching tweets that contain up to 140 characters. Some start with a #, some don't. I want to be able to produce any tweet that contains a # without altering the cotnent of the field at all.

Let me know your thoughts,

Evan Barrifk

morris70
Valued Contributor

Re: Searching for a character

Ok, in this case I would replace the IF- statement above with this one instead.

IF(IDtwContent LIKE '*#*', IDtwContent) AS Hashtag,

This will create a field called Hashtag containing all values from the field IDtwContent containing a #.

Community Browser