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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Update date when combo...
Power Apps
Unanswered

Update date when combobox is changed

(0) ShareShare
ReportReport
Posted on by 138

Hi 

 

Seems like such an easy thing to do, but i'm struggling! 

 

I have a form and gallery connected to my sharepoint list. When a user selects an item from the gallery, the form populates. 

 

I have a combobox (DataCardValue8) connected to a field on the sharepoint called "Approval"

There is also a date picker field connected to a sharepoint field called "Approval Date" 

 

I'd like to populate today's date into DataCardValue18 (date picker field) if "Access Granted" is selected in the combobox. 
If "Access Pending" or "Access Denied" is selected from the combobox, i'd like to clear the value from DataCardValue18. 

 

I've been using this code (which doesnt work) in the OnChange property of the combobox: 

If(DataCardValue8.Selected.Value = "Access Granted",
DataCardValue18.SelectedDate = Today(),
DataCardValue18.SelectedDate = Blank()
)

 

Can anyone tell me where I'm going wrong please? I dont get any errors, but the date doesnt update when I change the combobox.

 

Thanks, 

 

Categories:
I have the same question (0)
  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    Hi @stephenjcarr,

     

    On the DefaultDate property of the date picker control, try this code:

    If(DataCardValue8.Selected.Value = "Access Granted", Today(), Blank())

     

    Please tick Accept as solution if the answer is useful.

    Thanks,

    @AARON_C 

  • stephenjcarr Profile Picture
    138 on at

    Hi @AARON_C 

     

    Thanks for your response. 

    Apologies, I should have been more clear. In some instances, this field will already have been populated from the sharepoint list, So i would need the DefaultDate to be set as Parent.Default. 

     

    I would only need this code to happen on Sharepoint entries in which DataCardValue18 is blank and DataCardValue8 is set to "Access Pending". In all other circumstances, I would need the DefaultDate to be set to Parent.Default

     

    Hope this makes more sense! Thanks again for your help. 

     

  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    @stephenjcarr 

     

    I think this is what you are wanting to achieve? Try this on the DefaultDate property of DataCardValue18:

    If(!(DataCardValue8.Selected.Value) = "Access Granted"), varDate, Parent.Default)

     

    And on the OnChange property of DataCardValue8, put this:

    Set(varDate, If(Self.Selected.Value = "Access Granted", Today(), Blank()))

     

     

    Please tick Accept as solution if the answer is useful.

    Thanks,

    @AARON_C 

  • stephenjcarr Profile Picture
    138 on at

    Hi @AARON_C 

     

    Thanks again for your help. This shows an issue on DataCardValue18: Incompatible types for comparison. Types cant be compared: Boolean, Text) & the date doesnt update when I change the combobox

     

    Thanks, 

    Stephen

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard