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

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

| improve this answer | |
  • 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 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 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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