Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top