cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abrae005
Kudo Collector
Kudo Collector

Controlling Dropdowns with Combo Box

I'm building an app that will be used to record planned maintenance on some of our systems. On one screen, there is a combobox (cb_env) with the environment names. There are also dropdowns for each module within each environment.

 

I would like to change whatever is in all of the dropdowns for each environment when that environment is selected in the Combobox. If the environment is selected in the Combobox, then that column of dropdowns will show "Red X", otherwise, it'll show "Green Check"

 

It's working, sort of. There are 2 ways to get to this screen (which is Screen #2 in my app) - Method #1, you select "New Blank Form" on Screen 1. Or, Method #2, on Screen #1, you select from an existing saved version of the form (saved on a Sharepoint list). Each field is stored in the SP list, and it's loaded as collection SelEml.

 

The Combobox/Dropdown is working for Method #1 - New Blank Form. If you select one or more environments in the combobox, then the corresponding dropdowns turn to "Red X", and if you unselect it, it goes back to "Green Check"

 

But, if you're selecting an existing form (Method #2), it'll populate the combobox and the dropdowns with whatever is saved, but changing the combobox won't change all of the dropdowns in the respective columns. (The dropdowns can be manually changed) I'm guessing I need to modify something in the Dropdown Default formula, but not sure what. Any help would be appreciated.

 

Code snippets below the screenshot.

 

Powerapp.png

 

cb_env DefaultSelected Items: 

 

RenameColumns(Split(First(SelEml).Load_cb_Env, ", "),"Result", "Value")

 

 

cb_env OnSelect and OnChange are both set to false

 

dd_C1R1 Items:

 

["","Red X","Green Check"]

 

 

dd_C1R1 Default:

 

If(First(SelEml).Load_dd_C1R1 <> "", First(SelEml).Load_dd_C1R1, If(!IsBlank(Find(lbl_C1Head.Text,Concat(cb_Env.SelectedItems, Value, ";"))),"Red X","Green Check"))

 

 

(The rest of the dropdowns have names according to where they are in the grid ... for example, 3rd column, 2nd row is dd_C3R2, and they all have the same "Default" formula, except the column/row references are changed) 

5 REPLIES 5
PowerAddict
Super User
Super User

Hi, 

 

I am curios to know what the behavior is if you simply set the dropdown's default property to: 

If(
    !IsBlank(
        Find(
            lbl_C1Head.Text,
            Concat(
                cb_Env.SelectedItems,
                Value,
                ";"
            )
        )
    ),
    "Red X",
    "Green Check"
)

Because the dropdown simply has to behave based on the selected items in the combo box of environments. 

 

Let me know what happens. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Hi @PowerAddict 

 

That solution works for the problem I described. However, I now realize that my original post forgot another reqirement - namely that even if an environment is selected, not all modules may be "Red X" status.

 

For example, if the system vendor says "We're going to do maintenance in the Staging environment, on Modules B & C", then my team would choose Staging in cb_Env, but manually flip dd_C2R1 back to "Green Check". It would save correctly to SP, but later, if I come back to that outage, it will be showing up as a Red X, because with your solution, it's only keying on cb_Env value, not looking at the value that was saved in SP.

Sure, since the requirement wasn't specified earlier, the solution doesn't cater to that 🙂 

 

So, one quick question, when you say "if I come back to that outage", does that mean coming back to the same screen? Or is there another screen? And, when they come back to this screen, will there will be just environment selected or can there be more than one? 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

This screen is the 2nd screen in the App. Screen #1 gives you the option to start a new blank form, or, load an existing saved record from the Sharepoint list. So, when I say "Come back to this outage", it would mean choosing the saved record on Screen 1, and having it load everything that was saved to SP.

Hi @PowerAddict  - Don't mean to nag (well, actually, maybe a little ;)), but do you have any other ideas on how I could make this work? 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,512)