cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
egallis
Level 10

Re: Filter ComboBox using another field?

One question though: where are your RadioButton and ComboBox controls located in your app?

  1. Directly on the screen
  2. Inside a form
simms7400
Level 8

Re: Filter ComboBox using another field?

controls.png

 

@egallis  Hi -

 

Right here:

 

egallis
Level 10

Re: Filter ComboBox using another field?

Ok, so here is what I suggest you to do...

As I said earlier, collect your data in the OnChange event of your RadioButton control:

 

Set(
gloRDList,
Filter(
Switch(
Radio1.Selected.Value,
"Asset",
RD_Portfolio_Compound_List,
"Investment",
 RD_Investment_Compound_List,
"Target",
RD_Target_Compound_List
),
Not(Lower(Portfolio_Status)="terminated")
)
)

That way, at all times, you will have a global variable called gloRDList with all items from the correct datasource and without the records that are "Terminated".

Then on your ComboBox control, just put the following formula in the Items property:

gloRDList.Alias

If I'm not mistaken and if I didn't forget anything, that should do the trick...

Tell me if this works.

If it does, I'll have to explain to you then how to clear you ComboBox when you select another radio button.

Emmanuel

 

simms7400
Level 8

Re: Filter ComboBox using another field?

@egallis  Okay will do!

 

Now, what do I do with the ComBox "items" box? I currently have this located there:

If(Radio1.Selected.Value="Asset",
    Filter(RD_Portfolio_Compound_List,"Terminated" <> Portfolio_Status).Alias,
    Radio1.Selected.Value="Investment",
    Filter(RD_Investment_List,"Terminated" <> Portfolio_Status).Alias,
    Radio1.Selected.Value="Target",
    Filter(RD_Target_List,"Terminated" <> Portfolio_Status).Alias
)

Do I replace with the global variable?

egallis
Level 10

Re: Filter ComboBox using another field?

Yes, remove everything and put the global variable as in my post...

simms7400
Level 8

Re: Filter ComboBox using another field?

@egallis 

 

I placed the variable in the Combox Items and it's working!!!!!  no more terminated items!!!

 

How do I clear the drop down though?

egallis
Level 10

Re: Filter ComboBox using another field?

Great !

So... To clear the dropdown when you select another radio button (because the current ComboBox value may not be available in the newly selected datasource), we're going to use the Reset property of the ComboBox.

See the Reset property as a switch: when it goes from false to true it resets the control, clearing the user's selection.

To do so, just ADD the following code AFTER the actual code of your Radio1.OnChange:

Set(gloResetRadio1,true);
Set(gloResetRadio1,false)

And set your ComboBox.Reset to:

gloResetRadio1

And that's it !

View solution in original post

simms7400
Level 8

Re: Filter ComboBox using another field?

@egallis  Thank you! That works great!!

 

Is there also a way to clear the button as well? FOr instance, when I submit or click the "back" button I want the button to be cleared as well.  Thank you so much!!!

egallis
Level 10

Re: Filter ComboBox using another field?

Gald it works... Don't forget to mark the post as the solution so other people know...

About the button... Can you be more specific ? What button ? Where is it located ? What is it used for ? What's the code of its OnSelect property ?

simms7400
Level 8

Re: Filter ComboBox using another field?

@egallis  I meant the Radio1 button.  While your code clears the drop down if I were to select on the new button, which is PERFECT, I also when to clear all buttons if i were to hit the "Back" or "Submit" icons on my forms - uniess thats not really necessary?

 

Also this form also has a gallery. This gallery displays all aossicatd data element to the member that is displayed in my text box. THerefore, then the end user knows what to select (Target, Asset, Investment).

 

However, I need ot add one condition to it. On the data source, there is a field called "RequestStatus" where I only want to display things in my gallery with a "RequestStatus" of "Published".

 

Here is my current code for my gallery:

SortByColumns(Filter(rdPartnerAssets,Title=PshipBrowseGallery.Selected.PartnershipId,StartsWith(Title, DataCardValue73.Text)), "Associated_Alias")

However when I add the other condition it doesn't seem to recognize it. I tried this with no success:

SortByColumns(Filter(rdPartnerAssets,Title=PshipBrowseGallery.Selected.PartnershipId  && RequestStatus="Published",StartsWith(Title, DataCardValue73.Text)), "Associated_Alias")

Do you know where I'm going wrong? Thank yous so much!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,872)