cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
miguelrodrigue Helper III
Helper III

Add static value to a dynamic dropdown using previous dropdown values

hello!

I need some help coming up with a formula that uses a different multiselection dropdown's values and pass them to a new drop down along with a static value

 

my current failure attempt at a formula to try and show what I was thinking:

FormTypeValue.SelectedItems + ["Main Screen"]

 

thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
enelson906 Helper V
Helper V

Re: Add static value to a dynamic dropdown using previous dropdown values

It looks like you're trying to add more than one item to a each collected record. That's probably why it's telling you it's a table. So instead of using SelectedItems, change it to Collect(ScreensSelected,{'Form Type':FormTypeValue.Selected.Value}).  This will tell it to add one item at a time. This should work with either a simple dropdown or a combobox type. Lemme know if that works for you.

View solution in original post

7 REPLIES 7
enelson906 Helper V
Helper V

Re: Add static value to a dynamic dropdown using previous dropdown values

Set the OnChange property of your first dropdown to populate a new single column collection.  Set the Item property of your second dropdown to this collection. If you need a static value in there you could start your collection with it. So maybe the onselect property of either dropdown could collect it to your new collection. 

miguelrodrigue Helper III
Helper III

Re: Add static value to a dynamic dropdown using previous dropdown values

mind giving me an example formula so I can get a better Idea of what you mean?

enelson906 Helper V
Helper V

Re: Add static value to a dynamic dropdown using previous dropdown values

So for the first Dropdown I just put in a simple list of colors ["Red", "Blue", "Green"], you'd want to use your initial datasource. But for my example, go to the OnChange property of the first dropdown and: 

 

Collect(CollectSomeColors, {a_color: Dropdown1.Selected.Value})

 Then for the second dropdown set its item property to:

CollectSomeColors

 As you make selections from the first dropdown it will populate your collection and those selections will show up in your second dropdown.

 

If you need a static value in there then you could start your collection with a different trigger. So if I knew that no matter what I want the color purple to show up in the 2nd dropdown I might go to the button that navigates to that screen and add in:

Collect(CollectSomeColors, {a_color: "Purple"});
Navigate(toYourDropDownScreenOrWhateverItIsCalled)

This way the first thing that shows up in your 2nd dropdown would be "Purple" regardless of what is added from the first dropdown.

 

You'll probably want to have a button somewhere to clear this collection out at some point so it can be reused so keep that in mind.

miguelrodrigue Helper III
Helper III

Re: Add static value to a dynamic dropdown using previous dropdown values

I'm trying it but can't seem to get it to work. I specified that this is a multiSelection dropdown. does that change anything? from what I understand the "a_color" part would not be the same

enelson906 Helper V
Helper V

Re: Add static value to a dynamic dropdown using previous dropdown values

a_color is just what I named my column, you could name it anything you want since it's a new collection. You mean a combobox right? It should work, I just tested it for simple dropdown and also for combobox. You'll have to add some logic if you want to avoid duplicates in your collection btw but I'd worry about that after you get the collect function working. 

 

Have you gotten the values from your datasource you want to show up in your first combobox already? If you have, then go its OnChange property and use this code below. Change ComboBox1 to whatever number or name you have for it.

 

Collect(myColl, {ddList: ComboBox1.Selected.Value})

 

Then, insert another combobox and go to it's Item property and put in myColl.

miguelrodrigue Helper III
Helper III

Re: Add static value to a dynamic dropdown using previous dropdown values

sorry this is giving me so much trouble but when I try to specify the variable is the 2nd dropdown it's saying that its a table and is just showing me x* amount of blanks in the dropdown instead of the actual text name. I'm assuming there's some way of pulling the information out of the table but I can't seem to find the documentation for that.

 

current onChange in first dropdown:

Collect(ScreensSelected,{'Form Type':FormTypeValue.SelectedItems.Value})

 

current items in second drop down:

ScreensSelected

enelson906 Helper V
Helper V

Re: Add static value to a dynamic dropdown using previous dropdown values

It looks like you're trying to add more than one item to a each collected record. That's probably why it's telling you it's a table. So instead of using SelectedItems, change it to Collect(ScreensSelected,{'Form Type':FormTypeValue.Selected.Value}).  This will tell it to add one item at a time. This should work with either a simple dropdown or a combobox type. Lemme know if that works for you.

View solution in original post

Helpful resources

Announcements
secondImage

Community User Group Member Badges

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

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

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