cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simms7400
Post Prodigy
Post Prodigy

Filter ComboBox using another field?

Hi Folks -

 

I have a forum that has a data source of "rdPartnerAssets" and a ComBox that is populates with a certain source (Table.Column) based on a Radio button selection on my form.

 

However, I would like if I can filter ComboBox with another field from that source.  Each source has a SP column called "Portfolio_Status" and I'd like to return all value from the particular data source where "Portfolio_Status" <> Terminated.

 

My current formula is as follows:

If(Radio1.Selected.Value="Asset",RD_Portfolio_Compound_List.Alias,Radio1.Selected.Value="Investment",RD_Investment_List.Alias,Radio1.Selected.Value="Target",RD_Target_List.Alias)

I tried th filter function, but can't seem to get it to fire. Thanks!

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

33 REPLIES 33
Mr-Dang-MSFT
Power Apps
Power Apps

Formatted:

 

If(Radio1.Selected.Value="Asset",
    RD_Portfolio_Compound_List.Alias,
    
    Radio1.Selected.Value="Investment",
    RD_Investment_List.Alias,
    
    Radio1.Selected.Value="Target",
    RD_Target_List.Alias
)

 

 

If I'm understanding this right, you want to change which table's data appears here based on different values in the radio control.

 

Next you want to filter the content where the status is not terminated.

 

It could look like this:

 

If(Radio1.Selected.Value="Asset",
    Filter(RD_Portfolio_Compound_List,Not(Status="Terminated")).Alias,
    
    Radio1.Selected.Value="Investment",
    Filter(RD_Investment_List,Not(Status="Terminated")).Alias,
    
    Radio1.Selected.Value="Target",
    Filter(RD_Target_List,Not(Status="Terminated")).Alias
)

 

Reading from inside out. This filters the Portfolio Compound List to show only the records where the status is not terminated when the value selected in the radio is Asset, else it moves onto the other conditions. In each case, only show the Alias column.

 

As a rule of thumb, even though each table has the same structure, I generally avoid fitting different tables into the same control. That's just me nitpicking.

 

@Drrickryp , @timl who can see what function you can replace the If with to simplify the formula even more 🙂

 

@Mr-Dang-MSFT  Thank you!

 

However, my lists are still returning the "Terminated" elements from their respective tables.

@simms7400 - Just to confirm, I assume that you amended Mr Dang's condition to refer to your 'Portfolio_Status' field, rather than Status. Could you clarify the data type of 'Portfolio_Status'? Is it a Choice column? Do the data items in 'Portfolio_Status' include exactly the text 'Terminated'? (ie, with a capital T, no trailing spaces)

@Mr-Dang-MSFT - I see what you're trying to do - Switching this question into a quiz 😉

Hi @simms7400 

Do you want to filter the records not equal to “ Terminated"?

Could you tell me what is the data type of 'Portfolio_Status' column?

I assume that's a text column.

I recommend you try this formula:

 

If(Radio1.Selected.Value="Asset",

    Filter(RD_Portfolio_Compound_List,"Terminated" <> Status).Alias,

   

    Radio1.Selected.Value="Investment",

    Filter(RD_Investment_List,"Terminated" <> Status).Alias,

   

    Radio1.Selected.Value="Target",

    Filter(RD_Target_List,"Terminated" <> Status).Alias

)

 

 

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft @timl 

 

Hi both - "Portfolio_Status" is a text field. 

 

I've tried the above formula and it is still returning records from the source table where "Portfolio_Status = "Terminated".

 

 

@v-yutliu-msft @timl  Hi Team - Sorry for the bother.

 

I was wondering if there was anything else I should be trying?  Thanks.

Hi @simms7400,

Maybe your problem comes from the fact that a combo box items should (most of the time) be fed with the Choices() function in order to work properly.

So, assuming your Alias field is a choice or lookup field, this means that the above formulas given by @Mr-Dang-MSFT or @v-yutliu-msft should more likely look like this (by example for the Portfolio datasource):

Filter(
Choices(RD_Portfolio_Compound_List.Alias),
Not(
TrimEnds(Lower(Value))="terminated" // <- make sure "terminated" is all lowercase
)
)

Note the TrimEnds() and Lower() functions to make sure equality of string values won't be bothered by extra spaces or upper/lowercase letters.

 

Another idea would be to do the following:

  • in the OnChange event of your RadioButtons control, set local or global variable RD_List_DataSource with the right datasource according to the selection radio button
  • in the Items property of your combo box, set the following formula:
Filter(
    Choices(RD_List_DataSource.Alias),
    Not(
        TrimEnds(Lower(Value))="terminated" // <- make sure "terminated" is all lowercase
    )
)

Give us feedback once you'll have made some more tests...

Emmanuel

@R3dKap  Hi -

 

Thank you, but that doesn't validate.  Also, Alias isn't a choice column in the data sources.

 

 

Screen shot below:

chiucessss.png

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,089)