cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dhwu
Regular Visitor

Comparing a field to several identical fields without a circular reference

I'm creating a form that asks users to rate several different options from 1-5. It looks a little like this:

 

Option 1Option 2Option 3Option 4
1 - 2 - 3 - 4 - 51 - 2 - 3 - 4 - 51 - 2 - 3 - 4 - 51 - 2 - 3 - 4 - 5

 

I'm using Rating controls right now, but I can do dropdown or radio buttons in a pinch. Because I don't want users to take the lazy way out and rate 5 stars across the board, I want to set up a control that prevents each rating from being used more than twice. For example, if a user gives Option 1 five stars, and then gives Option 2 five stars, trying to give Options 3 or 4 five stars will cause those fields to reset and a message to pop up saying those stars can only be given twice. This will be the case for all ratings 1-5.

 

My problem is, how do I compare each rating to every other rating without causing a circular reference? 

4 REPLIES 4
zmansuri
Super User
Super User

what does your database schema look like?

dhwu
Regular Visitor

This Power App is a SharePoint List app. The row is actually a single "multiple lines of text" column in the list. Each rating will be represented as

"Option 1: x Stars

Option 2: x Stars

Option 3: x Stars

Option 4: x Stars"

in the column.

 

The final app will have 9 options and 20 rows, for 180 star ratings total, so I felt it would be most convenient to compress the number of necessary fields to 20 list columns.

believe me it will be really complicated logic.

If(
    Rating1.Value = Rating1_1.Value || Rating1.Value = Rating1_2.Value || Rating1.Value = Rating1_3.Value || Rating1_1.Value = Rating1.Value || Rating1_1.Value = Rating1_2.Value || Rating1_1.Value = Rating1_3.Value || Rating1_2.Value = Rating1.Value || Rating1_2.Value = Rating1_1.Value || Rating1_2.Value = Rating1_3.Value || Rating1_3.Value = Rating1.Value || Rating1_3.Value = Rating1_2.Value || Rating1_3.Value = Rating1_2.Value,
    Notify(
        "Error",
        NotificationType.Error,
        500
    )
)

 

The above code will compare 4 individual ratings with each other . imagine the code with all your requirement. And another thing if you'll ask mandatory different stars in each rating that defeats the purpose of rating. let's say i gave one option 5 start another 5 start. then there is option 3 i will have to give anything but 5 star. You will not get accurate result with this kind of validations. ratings should be free. you can set some general rules like out of those 9 options if 5 have 5 start rating then before submit you can just show pop up reminding them that they have given unusual ratings. otherwise forcing them to rate specific is not user friendly

dhwu
Regular Visitor

Painful logic is something I'm prepared for. Where do I put it to make sure it updates with every selection?  In the DataCardValue.Default field?

 

We are trying to narrow down options to a single preferred one, so it's necessary for us to enforce these unique ratings. Think of it as 1st place, 2nd place, etc. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,087)