Hi PowerApp Experts,
I have a created a canvas app connected to D365. On the Entity, Appointment, I want to have a scenario, where on select of Start Date, the End Date also has to be filled with the same date. However, this does not seem to work.
OnChange of Start Date, I have written the following code.
If(
IsBlank(EndDateValue.SelectedDate),
UpdateContext( {selectedDate: StartDateValue.SelectedDate} ); Set(selectedDate, EndDateValue)
)
Can you please support me here?
Thanks a lot
SN.
Solved! Go to Solution.
Hi @SantoshNilla ,
I have made a test on my side, please take a try with the following workaround:
set the OnVisible property of the current screen to following:
Set(SelectedStartDate, Blank());
Set(IsEndDateBlank, false)
Set the OnChange property of the Start DatePicker control to following:
Set( SelectedStartDate, StartDatePicker.SelectedDate );
If(IsBlank(EndDatePicker.SelectedDate), Set(IsEndDateBlank, true), Set(IsEndDateBlank, false))
Set the Default property of the End DatePicker control to following:
If( IsEndDateBlank = true, SelectedStartDate )
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
If you set the DefaultDate property of your End Date field to the SelectedDate from your Start Date field (e.g. dte_StartDate.SelectedDate), any changes to Start Date should update End Date.
Hope that helps
Proud to be a Flownaut!
Follow me on Twitter at @QG_LeeJHarris
Or on LinkedIn at in/leejharris
Hi @SantoshNilla ,
Based on the formula that you provided, I think there is something wrong with it.
Actually, it is not necessary to initialize a variable to store the selected date value within the Start Date Picker control. Instead, you could bind the Start DatePicker control and the End DatePicker control directly.
I have made a test on my side, please consider take a try with the following workaround:
set the DefaultDate property of the End DatePicker control to following:
StartDatePicker.SelectedDate
Please check the following GIF screenshot for more details:
If you want to store the selected Date value in your Start DatePicker control into a variable, please take a try with the following workaround:
Set the OnChange property of the Start DatePicker control to following:
Set(SelectedDate, StartDatePicker.SelectedDate)
Set the DefaultDate property of the End DatePicker control to following:
SelectedDate
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
Thanks for your responses. Really appreciated.
I already tried this out and it works. However I guess I missed to inform you a very important criteria, where it the problem actually arises.
The start date should be copied to end date only if the end date is not yet selected.
When trying to use the IsBlank function, I am getting a cyclic redundency error.
Thanks for your support,
SN.
I think I have managed to get this working to meet your requirement.
For the purposes of this example I have two date fields, dte_StartDate and dte_EndDate.
dte_StartDate properties
DefaultDate: Today()
OnChange: If(IsBlank(dte_EndDate.SelectedDate),UpdateContext({DefaultEndDate:dte_StartDate.SelectedDate}))
dte_EndDate properties
DefaultDate: DefaultEndDate
You may also wish to have a "Reset Defaults" button that has an OnSelect value of UpdateContext({DefaultEndDate:Blank()})
Hope this helps.
Proud to be a Flownaut!
Follow me on Twitter at @QG_LeeJHarris
Or on LinkedIn at in/leejharris
Hi @SantoshNilla ,
I have made a test on my side, please take a try with the following workaround:
set the OnVisible property of the current screen to following:
Set(SelectedStartDate, Blank());
Set(IsEndDateBlank, false)
Set the OnChange property of the Start DatePicker control to following:
Set( SelectedStartDate, StartDatePicker.SelectedDate );
If(IsBlank(EndDatePicker.SelectedDate), Set(IsEndDateBlank, true), Set(IsEndDateBlank, false))
Set the Default property of the End DatePicker control to following:
If( IsEndDateBlank = true, SelectedStartDate )
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
Hi @SantoshNilla ,
Have you taken a try with the solution I provided above?
Have you solved your problem?
If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.
Best regards,
Hi @v-xida-msft
I was able to perform the similar steps and I got it working.
Thanks a lot for your your support, @v-xida-msft & @LeeHarris . Really appreciated.
SN.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
14 | |
4 | |
4 | |
3 | |
3 |