Jun 14 2022 11:31 AM
Is it possible to have the default date of a date picker control be programmatically set when a user clicks a drop down? I have two controls, DropDown1 and DatePicker 1. What I would like, is when the user clicks the DropDown1, the default date of DatePicker1 changes to 10 days from today's date.
TIA,
Tom
Jun 15 2022 01:02 AM
Solution@TRundle2022 yes you can set the DefaultDate property to change based on the selection in the dropdown. Make sure you have set the first item in the dropdown to "" then set the DefaultDate property of the date picker to:
If(Dropdown1.Selected.Value <> "",Today()+10,Today())
Or you can do something like this to set it to a date based on which item in the dropdown has been selected:
If(Dropdown1.Selected.Value ="Anguilla",Today()+10,If(Dropdown1.Selected.Value= "Antigua",Today()+20, Today()+30))
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
Jun 28 2022 06:48 AM
@RobElliott Thank you. When I used the first formula, it threw an error, 'Value' isn't recognized. I changed the formula to If(Dropdown1.SelectedText.Value <> "",Today()+10,Today()), and that worked.
Thank you
Oct 18 2022 01:20 PM
I am trying to do something similar, but to populate the default date with the text in the drop down.
I have a data connection to another list where the user must select from the authorized dates, I'm pulling those dates into a drop down as text. Then I need to update the date with the selection.
Dates being pulled into DDdayOne value: Distinct(Filter('Class-Calendar', Category.Value = "Bluebeam" And Today() <= 'Start-Date'),'Start-Date')
DatacardValue2-DefaultDate = DDdayOne.SelectedText
How do I convert text into date format?
Oct 18 2022 11:11 PM - edited Oct 18 2022 11:12 PM
@ColleenBristol You can try using DateValue() function in Power apps. Dates must be in one of these formats:
Example
DateValue(inputStartDate.Text)
Documentation: DateValue function in Power Apps
Please consider giving a Like if my post helped you in any way.
Jun 15 2022 01:02 AM
Solution@TRundle2022 yes you can set the DefaultDate property to change based on the selection in the dropdown. Make sure you have set the first item in the dropdown to "" then set the DefaultDate property of the date picker to:
If(Dropdown1.Selected.Value <> "",Today()+10,Today())
Or you can do something like this to set it to a date based on which item in the dropdown has been selected:
If(Dropdown1.Selected.Value ="Anguilla",Today()+10,If(Dropdown1.Selected.Value= "Antigua",Today()+20, Today()+30))
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)