cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

need help adding dropdown selection to radio button selected OnSelect filter.

Hi Community, I am a relative beginner at Power Apps and was given the task of adding a dropdown selection to a tablet app which was built by someone else in our company who is no longer here. I'm trying to a filter an already controlled by a radio button selection. I have so far tried adding a multiple " If(Dropdown_partner.SelectedText.Value="yes"), do this" to the radio button code in a few different places no avail anywhere.

 

I'd like to start with the dropdown selection "yes or no" then run the radio button code based on the selection of the dropdown when the button is pressed.

 

Any help would be "GREATLY" appreciated because I have no idea how this is supposed to work.

 

Thanks in advance,

Will

 

Screen OnVisible code:

 

UpdateContext({varScreenTitle: "Test Plan Creator"});Clear(colTrips);If(IsEmpty(colLocations),ClearCollect(colLocations,locations));
UpdateContext({allSel: Filter(colLocations,ZoneLeader="Yes" || New="New" )});
Set(showMenu,false);UpdateContext({Loadingvar:false,Created:false});

 


Radio Button OnChange code:

 

UpdateContext({Loadingvar:true});
Switch(
    P2PTypeRadio.Selected.Value, 
    "Zone2Zone",
    UpdateContext(
        {
            allSel: Filter(
                colLocations,
                ZoneLeader = "Yes"
            )
        }
    );
    UpdateContext({formType: "Zone2Zone"}),
    "New2Zone",
    UpdateContext(
        {
            allSel: Filter(
                colLocations,
                ZoneLeader = "Yes" || New = "New"
            )
        }
    );
    UpdateContext({formType: "New2Zone"}),
        "Zone2Zone w/New",
    UpdateContext(
        {
            allSel: Filter(
                colLocations,
                ZoneLeader = "Yes" || New = "New"
            )
        }
    );
    UpdateContext({formType: "Zone2Zone w/New"}),
    "Custom",
    UpdateContext({formType: "Custom"}),
    "All",
    UpdateContext(
        {
            allSel:
                Filter(colLocations,New="New"||New="Normal")              
        }
    );
    UpdateContext({formType: "All"})
);
Clear(colComboTrips);UpdateContext({Loadingvar:false});

 

 

Button OnSelect code:

 

UpdateContext({Loadingvar:true,Created:true});

 

 

 

6 REPLIES 6
Super User
Super User

Are you trying to change the items in the dropdown based on the Radio selection?   If so you need to modify your dropdown items property.

 

If(

  P2PTypeRadio.Selected.Value = "Zone2Zone", Filter(colLocations, ZoneLeader = "Yes",

P2PTypeRadio.Selected.Value = "Zone2Zone w/new", Filter(colLocations, ZoneLeader = "Yes" And New = "New",

)

 

And so on

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

@JR-BejeweledOne  "long story short, I've been given this project and I'm a real newb to Powerapps. I've watched a bunch of videos on YT, but my answer is not to be found. I also don't have any references to go back to for the code, because the person who made the app is no longer with our company.

 

So, I am actually trying to update the output of the Radio Button OnChange code (above), based on if "Blue" or "Red" is selected in the dropdown (Dropdown_vendor1) I've added to the screen.

 

I have 2 new columns in my collection (colLocations)  I want to sort the original output if Red="Yes" OR Blue="Yes if selected in the new Dropdown box with Red and Blue as values.

 

It may look something like this in the end: 

UpdateContext({allSel: Filter(colLocations, ZoneLeader = "Yes" || New = "New" && Red = "Yes")});

Which I've tried, but it doesn't work....

 

I hope this makes prefect sense.....???

Couple questions.

 

  1. Where is 'allSel' being used?
  2. You said 2 new columns?  If these are for your Red and Blue values, it might be better to have a single choice column with Red and Blue as the values.

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

  1. Where is 'allSel' being used?
    Not quite sure. As far as I know it's only in the Radio Button OnChange code. 
  2. You said 2 new columns?  If these are for your Red and Blue values, it might be better to have a single choice column with Red and Blue as the values.
    The 2 new columns named "Red" and "Blue" are in the data source, we will add more columns over time, so I will also be adding the "new" column names to the dropdown as well. Red AND Blue can have values of "Yes", "No", "Normal", and "Not Used". I am only interested in an outcome if they are "Yes"

The formula on the radio Onchange property is setting the value of allSel.    allSel is being used somewhere else.   You can find out by going to the menu at the top left and clicking on 'View'.   Then click on Variables.    allSel is a local context variable and not a global variable so it won't be under the Global selection.

 

Select the screen to see the local context variables.   Select the variable in the pane on the right and then click on the 'Uses' tab to see where it's used.

 

varscreen.jpg



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Here is what I found.

wwallace86_0-1605551562722.png

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (81,880)