cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Using a Toggle Switch to Change Data Source in a Dropdown

Hello,

 

I'm trying to use a toggle switch that when switch ON will change the data source of a drop down menu. The data source for the drop down menu will be either be Collection1 or Collection2. What I want my users to be able to do is to have the option to selection from either a specific portion of a collection or a seperate one. Here's the current formula that I'm using that works:

 

If(RosterToggle.Value = true, Collection1.Name, Collection2.Name)

This will allow me to select rosters from either collection. Works just fine.

 

 

However, if I want to be reference a specfic part of the either collection, turns up an error. 

 

 

If(RosterToggle.Value = true, Text(Filter(CachedSelectSchedule,
 Shift = TimeOfDay.SelectedText.Value),Rs1Day), CachedSelectSchedule.CrewMember)

 

What's the best way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Using a Toggle Switch to Change Data Source in a Dropdown

Hi @BrendonBrooksP1 ,

 

Could you share more information about the error information?
Is ‘Rs1Day’ a Column name in CachedSelectSchedule?

According to my test, I found there are two point wrong with your formula.

First, I think there is no need to use Text function, and the usage of Text function in your formula is inappropriate.
Text function is used to converts any value or formats a number or date/time value to a string of text. For more information, please refer to this doc: Text function in PowerApps

Second, the columns of two Collections you choose as the item of drop down list should have the same column name.
So you need two collections to store the items with the same column name. and then the issue will be fixed.

Finally, please refer to my test:
The item property of dropdown list: If(Toggle1.Value=true, Filter(collection1,name="A").shift, collection2.shift)
Capture.PNGCapture2.PNG
Best regards,
Sik

 

View solution in original post

2 REPLIES 2
Helper V
Helper V

Re: Using a Toggle Switch to Change Data Source in a Dropdown

Try this:

If(RosterToggle.Value, Distinct(Filter(CachedSelectSchedule, Shift = TimeOfDay.SelectedText.Value), Rs1Day), Distinct(CacheSelectSchedule, CrewMember))
Highlighted
Community Support
Community Support

Re: Using a Toggle Switch to Change Data Source in a Dropdown

Hi @BrendonBrooksP1 ,

 

Could you share more information about the error information?
Is ‘Rs1Day’ a Column name in CachedSelectSchedule?

According to my test, I found there are two point wrong with your formula.

First, I think there is no need to use Text function, and the usage of Text function in your formula is inappropriate.
Text function is used to converts any value or formats a number or date/time value to a string of text. For more information, please refer to this doc: Text function in PowerApps

Second, the columns of two Collections you choose as the item of drop down list should have the same column name.
So you need two collections to store the items with the same column name. and then the issue will be fixed.

Finally, please refer to my test:
The item property of dropdown list: If(Toggle1.Value=true, Filter(collection1,name="A").shift, collection2.shift)
Capture.PNGCapture2.PNG
Best regards,
Sik

 

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,081)