web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using toggle to change...
Power Apps
Answered

Using toggle to change different columns

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone!

 

I am building a relational database where I want the user to determine who is a business partner of who and save such info on a sharepoint lists. As an example:

 

There are Companies A, B, C and D. 

* A can trade with B, C and D 

* B can trade with A, and D but not C

 

I was thinking of using a toggle to make it simpler for each user to select which company it can trade with and the end result would be something like the image below. 

rafaelcosta_0-1626364453038.png

 

The table itself is a bit more complex and the best way I thought was to create 1 column for each company and an indication of Yes/No. An example is below:

rafaelcosta_1-1626364658336.png

 

I manage for the toggle to understand the Yes and No's based on an If statement:

 

ThisItem.Company in Sort( Distinct( Filter(Business_Partners, If( Dropdown.Selected.Result = "Company A", 'Company A' = "Yes", "Company B", 'Company B' = "Yes", "Company C", 'Company C' = "Yes", "Company D", 'Company D' = "Yes")), Entity),Result)

 

My problem is: How do I patch if user decides that Company B can trade with C? My goal is for the googgle to change the Yes/No values in such sharepoint list.

 

Any suggestions? It can even be a completely different approach to the problem, script and Sharepoint. 

 

Thank you in advance! 

Categories:
  • Verified answer
    GarethPrisk Profile Picture
    2,828 on at

    As you are encountering, having your data model use columns for explicit Companies is going to become unwieldy and unmanageable long-term.

    Instead, refactor your data to simply be a relationship pairing.

    • Primary Company
    • Secondary Company
    • Can Trade?

    This way, you'll have a list of records that defines the behavior. You'll have to ensure your data is accurate, but it's data versus adding columns and having to manually update the app each time.

    I'd also have a list that defines the Companies, if you don't already.

    Then your drop-down shows the list of Companies.

    Your Gallery shows a filtered list where that Company is the Primary or Secondary. The row would dynamically show the side which isn't that Company, and show the Can Trade? value.

     

    This way, it's a single record to maintain and it accurately reflects the behavior from the perspective of either Company.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I get your point. Basically transposed each column into a new set of 1:n companies and repeat it for each "origin" company. There are some changes I had to do to output the data for the next step of the process but indeed this solved my problem.

     

    Thanks @GarethPrisk !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard