The seems to be a disconnect between how ratings work in SharePoint, the actual data values in the underlying table and how to use them in a PowerApp.
I’ll explain what and how I got the ratings to show in my PowerApp.
When you turn on ‘Ratings’ in a SharePoint list, like so:
The list apparently acquires two new columns called
- Rating (0-5)
- Number of Ratings
- Number of Likes
However in this scenario you only ever want to actual show the ‘Rating (0-5)’ field.
This shows a combined star input and displays the average rating with some hover over information as shown below.
All good so far. Wouldn’t it be nice to get this average rating value when we now use this list from a PowerApp? Well yes it would be helpful, but alas this is not to be.
For some strange reason the only rating field that seems to get exposed is not any of the above. Instead you get
- User ratings
which contains a comma separated list of all the ratings made. Like “2,3,3,4,5,2,5,5,3,”. Yes!, rather annoyingly it also carries a trailing comma!!
Well I suppose that something, but you now want to display the average rating and the number of votes made.
So you can now add the ‘Rating’ input to your form
and use the following formula to display the Average rating as the default value
If(IsBlank(Average(TrimEnds(Split(ThisItem.'User ratings',",")).Result, Result)),"0",Average(TrimEnds(Split(ThisItem.'User ratings',",")).Result,Result))
and the following to do a count of records
CountIf(TrimEnds(Split(ThisItem.'User ratings',",")).Result,Not IsBlank(Result)) & " people rated this"
The following shows you my PowerApp screen with debug labels. You’ll notice that, unfortunately, the Ratings input does not support half values!