cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Checkbox for calender days?

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.

17 REPLIES 17
Anonymous
Not applicable

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

Anonymous
Not applicable

@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

Anonymous
Not applicable

Almost there but is doing some thing weird,

 

So if I click week for which should start 9-22 and end 9-24

 

TClark_Pax8_0-1600263493200.png

 

The dates are coming out way off

 

TClark_Pax8_1-1600263513855.png

Is this because its still in the editor and no published yet?

Anonymous
Not applicable

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

  • The Checkbox's OnCheck property.(The checkbox you selected in the picture)
  • The setting of  “Select a Desk”

Best Regards,

Bof

Anonymous
Not applicable

@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

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,165)