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

Calendar Dropdown not firing OnChange event when programatically set.

I have started with a blank canvas App.

Added Outlook Calendar (Home > Add Screen > Calendar)
This works as expected.

 

I wanted to programmatically control the dropdownCalendarSelection1, so...

 

1. dropdownCalendarSelection1.OnChange det to Set(Provider, dropdownCalendarSelection1.SelectedText.Value)
2. I add a label named Label1

3. Label1.Text set to: "Rhamy" (Note this is one of dropdownCalendarSelection1 selection options)

4. Label1.OnSelect set to: Set(Provider, Self.Text)
5. dropdownCalendarSelection1.Default set to: Provider

With this, clicking the Label1 effectively changes the dropdownCalendarSelection1 text to Rhamy but it does not fire the dropdownCalendarSelection1.OnChange event which is what switches calendar and loads new calendar Data. Is there a way to programmatically fire its OnChange?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@cycle4passion 

Yes, a Gallery with a list of Names as it's datasource would allow you to then have them all displayed and in the OnSelect, you can do as you need just once (i.e. not doing over and over).

 

Give that a shot and, by all means, if you get stuck...come on back and post the issues.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

9 REPLIES 9
Super User III
Super User III

@cycle4passion 

I am not entirely sure what logical problem you are trying to solve with your approach.  You are already setting your "Provider" variable in the OnSelect of the label, and your have your dropdown set to that variable.  You shouldn't need to further set the variable again based on the change to that new selection.  So, a little confused on that.

 

Be that as it may...the Dropdown will not execute its OnChange action unless the user physically changes the selection.  A Combobox (unfortunately in many case) will execute the OnXxxxx actions when its defaultselecteditems property is changed.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

As reverse engineering as it sounds, I will have 40+ labels acting to select the different calendars. Because there are so many of them, I didn't really want to move and repeat all the logic currently applied in the  dropdownCalendarSelection1.OnChange.

 

I tried to give your suggestion of using a combobox (multiple selection off) a try but have had trouble in setting the the DefaultSelectedItem to Provider variable. Suggestions?

Super User III
Super User III

@cycle4passion 

I would say that the approach on the OnChange is highly programmatic/development in nature.  PowerApps derives its values from controls, so it is much easier to do and maintain to follow that principle in PowerApps.

 

Your Dropdown is a better approach over the Combobox as there are complexities with Comboboxes such as setting the SelectedItems - they are full records that must match the exact signature schema and values of the items property.

 

So, I would certainly be happy to offer some suggestions and give you a more PowerApp way of doing what you are doing, but I need you to describe a little more of what you are trying to achieve and perhaps provide a screenshot or two to describe the layout and flow.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Imagine you have to look through about 40 peoples calendars in order to figure out who was free. I can't rely on outlooks built in busy/free/etc because it is a judgment call on whether that person can "fit in" the task with an already full schedule.

 

So as is, I would open dropdown > scroll person > selected calendar> review calendar decide no and possible repeat this 40 times.

As a quicker option, I wished to have the names as labels and allow you to click > Look and then move on to speed the process.

Super User III
Super User III

@cycle4passion 

Following to some degree, but I am not sure I understand your concept of 40 labels - I see one in the screenshot.  Where are the rest?  

If I am reading what you are saying correctly, it seems the Dropdown>Scroll>Pick, is your pain-point.  So, it would seem that your approach would be better served with a Gallery of names.  Just click one and then calendar is shown.

Does this sound more inline with where you are trying to get, or did I miss the mark on what I read?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

I only included one label/name for now. I really like the idea of the gallery. I'll work on that.

Super User III
Super User III

@cycle4passion 

Yes, a Gallery with a list of Names as it's datasource would allow you to then have them all displayed and in the OnSelect, you can do as you need just once (i.e. not doing over and over).

 

Give that a shot and, by all means, if you get stuck...come on back and post the issues.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helper II
Helper II

With @RandyHayes advice I was able to accomplish what I needed. Layout choices are a little funky, so I will recap.

 

I wanted a list of names horizontally going across the gallery wrapping to the number of lines needed.

 

I placed a blank vertical gallery, and set Wrap count to 10, Which by the way is the maximum. This works but the names (in alphabetical order go down each of the 10 columns, and then reset to the top of the next column. It makes sense but I wanted them going across and wrapping to the next row. Therefore I changed it to Horizontal Column, Wrap Count 10 and got it to display as wanted. I also conditionally set font color, so it highlights the selected name. In essence this replicates what a webpage full of links would look like and do.

If(Parent.Selected.DisplayName = Self.Text, Color.Yellow, RGBA(255, 255, 255, 1))


The OnSelect Property for the name loads the Calendar Data

 

Thanks for the help @RandyHayes 

Super User III
Super User III

@cycle4passion 

Glad that worked out for you.

One slight bit of Detail - The Gallery will always add a ThisItem.IsSelected property to every item in your Gallery.  That will automatically determine if the item is selected and your formula will not break if you change something in your formula (i.e. different controls and conditions).

So:

If(ThisItem.IsSelected, Yellow, White)

Is equivalent to your formula but will be a little more flexible.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

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

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (20,411)