Average Star rating

0
How do I add an average star rating?   Do I need to use an Xpath?    
asked
2 answers
1

Hi Malika,

You can create a microflow to average the rating questions. The flow of the microflow can be designed like this .
1- Retrieve the relevant Questionarrie (via Database or Association according to your needs).
2- Calculate the number of how many questions there are using count from the Aggregate list operation activity. (If you don't want to take into account non-rated questions, you need to add extra activity here or don't forget to consider the default value)
3- Generate a variable (Integer or Decimal according to your needs, but preferably decimal)
4- Create a loop and iterate your Questionarrie list.
5- Add the rate attribute in each Questionarrie by making a change variable in the loop.($Variable = $Variable + IteratorQuestionarrie/stars)
6 - After the loop ends, you can reach the average value by making Variable/count. Where to keep this value is determined by your need, so I can't make a suggestion. (I would also like to remind you that the division is done with the "div" command)

I hope it helps.

Regards
Ridvan

answered
0

No. If you are using the Rating-widget like described here: https://docs.mendix.com/appstore/widgets/rating/ then you just need to assign the integer-attribute to the widget that you have placed on your page.

answered