0

I'm trying to get the SharePoint Ratings feature to work with PowerApp's Ratings control; there's no obvious way to correctly bind the two.

Detail

SharePoint lists have a Star Ratings feature which allows users to rate any item in a list, and provides an average rating for that item.

PowerApps has a Rating control which allows you to use star ratings systems / there's a tutorial on using this here. However the tutorial shows how to associate a numeric field in SharePoint with the ratings control in PowerApps. I'm after using the Rating control in PowerApps with the Rating feature in SharePoint.

  • I want the ability to get/set the rating given by the current user; so they can submit & amend their score for the system.
  • I also want to be able to provide the aggregate rating for this item given all users inputs.

When I deal with the SP Rating field in PowerApps I seem to get a text response; giving a comma separated list of ratings. Is there any way for me to get this as an array of numbers I can pass to the Average function?

Also is there a way I can hook into the current user's rating, such that they can submit a new rating and have their previous rating removed / replaced?

1

1 Answer 1

1

Use the Average and CountIf function in PoweApps:

https://blog.nicholasrogoff.com/2019/10/30/how-to-get-the-ratings-from-sharepoint-into-your-powerapp/

If(
    IsBlank(
        Average(
            TrimEnds(
                Split(
                    ThisItem.'User ratings'
                    ,
                    ","
                )
            ).Result
            , 
            Result
        )
    )
    ,
    "0"
    ,
    Average(
        TrimEnds(
            Split(
                ThisItem.'User ratings'
                ,
                ","
            )
        ).Result
        ,
        Result
    )
)

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-rating#related-functions

3
  • Ah nice; thank-you; it was the use of "Result" that I was missing / I'd just assumed the output of one function could go directly into the other, rather than suspecting it would create a Result column in the background. If (IsBlank(ThisItem.'User ratings'),"Not Rated",Left("★★★★★",Round(Average(TrimEnds(Split(ThisItem.'User ratings',",")).Result, Value(Result)),0))) (I ended up using a text field instead of Ratings field as wanted to include the result in a DataTable / couldn't nest the Rating control in the cell).
    – JohnLBevan
    May 19, 2020 at 8:15
  • ps. Any idea on how to do the second part of my question; i.e. allow a user to update their rating (given the value returned seems to be an anonymous csv of all ratings)? If not I'll post that as a separate question. Thank-you again.
    – JohnLBevan
    May 19, 2020 at 8:17
  • ThisItem.'User ratings' isn't recognized for some reason. I have the star ratings on and everything too
    – Paul Vu
    Sep 17, 2021 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.