cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sgggt
Frequent Visitor

Detect Sentiment Flow Error

I'd appreciate your help with this error:
 
ExpressionEvaluationFailed. The execution of template action 'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@body('Detect_Sentiment')?['score']' is of type 'Float'. The result must be a valid array.
 
Screen Shot 2020-08-10 at 8.07.07 PM.png
8 REPLIES 8

@sgggt 

Hi there.  So, your Apply to Each is expecting a list (array) and you're giving it a number.   Apply to each loops like to work their way down a list and do the same actions to each item on the list.  You'll want to replace the "Score" with a list of some sort (maybe the output from your list rows).

 

Before you do that, though, maybe we should chat about the intent of your flow and what the rest of it looks like.  That way, we can smooth out any other bumps, as well.

 

Keep us posted.

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

sgggt
Frequent Visitor

Hi there @edgonzales 

 

I'm looking to detect the key phrases of a specific hashtag on Twitter, record it on Excel and Sharepoint, then detect and provide a sentiment score and add it to the Excel spreadsheet. 

 

The key phrases are one per row. How can I detect a sentiment score for each row/keyword?

I then want to post this on to Power BI. If possible, I would like create a timeline/timestamp of when the hashtag was posted and what the sentiment was at that point and overlay it with an 3rd party graphic/snapshot of the timeline.  

v-litu-msft
Community Support
Community Support

Hi @sgggt,

 

Could you please tell us your desire?

 

Are you want to find a row in which Sentiment equals the tweet text?

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@sgggt 

Ok, got it.  Is your flow triggered with each tweet? Or are you doing a recurrence?

 

-Ed

sgggt
Frequent Visitor

@edgonzales the flow is triggered automatically anytime someone tweets using that specific hashtag, when it's not a retweet, and it excludes certain twitter accounts. 

Ok, so I think we've got everything except I'm not clear on the Key Phrases part.  Right now, we have all of the tools to do this:

 

  • Tweet comes in matching your criteria (specific hashtag, when it's not a retweet, and it excludes certain twitter accounts)
  • Detect sentiment of tweet
  • Add tweet info along with sentiment as a new row in Excel table.

 

If I'm interpreting the key phrases part correctly, maybe it's an additional condition?  Meaning:  Has to meet the criteria in bullet above AND contain a key phrase before continuing?  If that's the case, how many phrases do you have?  If not, please elaborate.

 

(almost there 🙂  )

 

Thanks!  

-Ed

sgggt
Frequent Visitor

Hi @edgonzales 

The key phrases flow doesn't have additional conditions on it. I want to extract the sentiment score and key phrases from tweets that pass the condition in step 1 shown in Power BI. My understanding is that depending on how many key phrases are extracted, there are that many rows inserted into excel? If so, then would the flow provide a sentiment score for each row/key phrase then post to Power BI?

@sgggt 

Ok, got it.  Now it makes much more sense.  I think we might have a couple of options, let me know what you think of either of these:

 

  • I don't think the key phrases will give enough context to detect the sentiment, but you can have another Detect Sentiment inside your first Apply to Each loop and grab the score for the phrase before adding the row to your Excel and SP List.
  • Also, if you move your Detect Sentiment of your tweet text above the Apply to each loop, that value may be available inside the loop for you to add the Tweet Text Sentiment score at the same time.
  • You should then be able to eliminate the List Rows step, as well as the second Apply to Each loop.
  • You can also move the Power BI to be inside the Apply to Each loop so that it adds to Excel, SharePoint, and PowerBI all at once (Is that intentional?  Rather than connecting PowerBI to read off of either Excel or SharePoint?)

Either way, let us know how that works out.

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,196)