I am trying to add a section in a canvas app that has checkboxes next to the calendar. The goal here is for each checkbox to select a week in the shown calendar, preferably just the Tuesday and Thursday of that week and set the value for a desk reservation. I have the rest of the app functioning but need to be able to set the correct days to the checked out variable. Any ideas? My googlefu is failing me on this one.
@v-bofeng-msft thanks for the reply! Sooooo close now. It is now writing to the list but for some reason its using todays date and not the selected dates. Checkbox1 is
OnCheck
Collect(Thecollection,{CheckOutFrom:DateAdd(_firstDayInView,2,Days)},{CheckOutTo:DateAdd(_firstDayInView,4,Days)},'Desk Reservations') /*Thecollection is my custom collection*/
OnUncheck
Remove(Thecollection,{CheckOutFrom:DateAdd(_firstDayInView,2,Days)},{CheckOutTo:DateAdd(_firstDayInView,4,Days)})
Cant figure out why the date is today's date and not the selected dates.
@v-bofeng-msft upon further review I think what you gave me is working fine but my "continue" button is the issue
It is currently:
Set(
selectedDate,
Calendar_1.StartDate
);
Set(
selectedEndDate,
Calendar_1.EndDate
);
Set(
startTime,
DateTimeValue(
Text(
selectedDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeFrom_1.Selected.Value)
)
);
Set(
endTime,
DateTimeValue(
Text(
selectedEndDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeTo_1.Selected.Value)
)
);
Navigate(DeskSelect);
I tried changing it to the following but that created a bunch of errors and the button stopped functioning
Set(
selectedDate,
Thecollection.CheckOutFrom
);
Set(
selectedEndDate,
Thecollection.CheckOutTo
);
Set(
startTime,
DateTimeValue(
Text(
selectedDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeFrom_1.Selected.Value)
)
);
Set(
endTime,
DateTimeValue(
Text(
selectedEndDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeTo_1.Selected.Value)
)
);
Navigate(DeskSelect);
I really appreciate all the help. This is my first Powerapp and I am struggling to power through this one.
Hi @Anonymous :
The value of Thecollection.CheckOutFrom is a table with one-column.You should use
Last(Thecollection).CheckOutFrom
instead of
Thecollection.CheckOutFrom
Best Regards,
Bof
Hi @Anonymous :
Has the problem been solved?
Is there anything else I can help?
If my answer helps, then please consider Accept it as the solution to help others.Thanks
Best Regards,
Bof
Almost there but is doing some thing weird,
So if I click week for which should start 9-22 and end 9-24
The dates are coming out way off
Is this because its still in the editor and no published yet?
@v-bofeng-msft I have attached the monitor for the testing. Its writing todays date as the first date for some reason. Let me know if there is anything else that can help.
Hi @Anonymous :
Is the attachment the running log of your app? It looks like everything is normal.
Could you show me:
Best Regards,
Bof
@v-bofeng-msft sure
For the OnCheck:
Collect(Thecollection,{CheckOutFrom:DateAdd(_firstDayInView,16,Days)},{CheckOutTo:DateAdd(_firstDayInView,18,Days)})
For the Desk:
Set(selectedDesk,ThisItem)
The desk is pulled from another list and selects the correct desk fine, for some reason though the on check is wanting to select todays day. The confirm button has the following
Set(
selectedDate,
Last(Thecollection).CheckOutFrom
);
Set(
selectedEndDate,
Last(Thecollection).CheckOutTo
);
Set(
startTime,
DateTimeValue(
Text(
selectedDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeFrom_1.Selected.Value)
)
);
Set(
endTime,
DateTimeValue(
Text(
selectedEndDate,
DateTimeFormat.ShortDate
) & " " & TimeValue(ddTimeTo_1.Selected.Value)
)
);
Navigate(DeskSelect);
I also tried using First(thecollection).CheckOutFrom but that didnt work either
User | Count |
---|---|
252 | |
102 | |
94 | |
50 | |
37 |