Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Wrong results in running a Qlikview script

I am running a Sentiment Analysis API in Qlikview. However I get only two sentiment score 0 and 0.25. One for the top header field and other for the first post. My text field has 4 rows in the table Timeine. Why am I not getting the missing ones ? Below is my script. Before this script, I have my data loaded from the table Timeline

LET noRows = NoOfRows('Timeline');

  

for i=0 to $(noRows)-1

   

  

     let text = peek('text', $(i), 'Timeline');

   

     Sentiment:

     LOAD

        '$(text)' as text,

        status as sentiment_status,

        score as sentiment_score

     FROM

     [http://localhost:5555/QVSource/TextAnalyser/?table=Sentiment&SentimentEngine=Alchemy&format=qvx&Mess...)]

     (qvx);

    

next

1 Solution

Accepted Solutions
MVP
MVP

Re: Wrong results in running a Qlikview script

pankajchopra wrote:

My other question is do you know how can I modify this script to generate another column saying that text is positive if the sentiment score is between lets say >0 and negative if its <0

modify the existing code section like:

Sentiment: 

LOAD

'$(text)' as text,

status as sentiment_status,

score as sentiment_score,

If (score<0, 'Negative' , 'Positive' ) as Score_flag

FROM ..

4 Replies
MVP
MVP

Re: Wrong results in running a Qlikview script

Have you checked if the field text (table - Sentiment) is getting populated with all the four values as in table - 'Timeline' ? If the answer is yes, then I would request you to see if there is really other values in your source

     FROM

     [http://localhost:5555/QVSource/TextAnalyser/?table=Sentiment&SentimentEngine=Alchemy&format=qvx&Mess...)]

     (qvx);

   

Because your data load would be done on variant

     FROM

     '......Message=$(text)]

     (qvx);

   

Not applicable

Re: Wrong results in running a Qlikview script

Hi tres

Thank you for your reply.

So I found that QV is giving me the right results actually. It just doesnt gives a value for every posts instead it will ige only one value in my case 0 for all texts which had a neutral sentiment and the other value for one text which had a positive sentiment. So in my case 3 of the rows of text had a 0 value because when I click on them they all point to 0 sentiment score. I guess this is because of the associative technology of QV.

My other question is do you know how can I modify this script to generate another column saying that text is positive if the sentiment score is between lets say >0 and negative if its <0

MVP
MVP

Re: Wrong results in running a Qlikview script

pankajchopra wrote:

My other question is do you know how can I modify this script to generate another column saying that text is positive if the sentiment score is between lets say >0 and negative if its <0

modify the existing code section like:

Sentiment: 

LOAD

'$(text)' as text,

status as sentiment_status,

score as sentiment_score,

If (score<0, 'Negative' , 'Positive' ) as Score_flag

FROM ..

Not applicable

Re: Wrong results in running a Qlikview script

Thank you very much Tres

Community Browser