web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Calendar Dropdown not ...
Power Apps
Answered

Calendar Dropdown not firing OnChange event when programatically set.

(0) ShareShare
ReportReport
Posted on by 94

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?

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @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.

  • cycle4passion Profile Picture
    94 on at

    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?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @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.

     

  • cycle4passion Profile Picture
    94 on at

    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.

    Untitled.png
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @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?

  • cycle4passion Profile Picture
    94 on at

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

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @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.

  • cycle4passion Profile Picture
    94 on at

    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 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @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.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard