cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DavidMullett
Helper I
Helper I

Different Filter and Date behaviour between PowerApp app and embedded in SharePoint

Hi there,

 

I've implemented a desk booking app which April Dunham developed. After changing it all to UK datetime and adjusting it the way we need for our needs I've come across a problem.

 

When testing in Power Apps when I search for a desk it checks the SP list and omits any already booked desks for the date/time selected. This is also the behaviour in the Power Apps app on mobile. However if someone accesses the Power App which is embedded in a Sharepoint site when selecting a desk it does not filter correctly even though it is pulling the same data. The only thing I can think of is something to do with Date/Time.

 

The SharePoint site is set to be the correct regional setting.

 

Here is the calendar function to collect what date/time has been selected:

Set(
    selectedDate,
    DateTimeValue(Calendar_1.StartDate)
);
Set(
    selectedEndDate,
    DateTimeValue(Calendar_1.EndDate)
);
Set(
    startTime,
        DateTimeValue(Text(
            selectedDate, "dd/mm/yyyy"
        ) & " " & ddTimeFrom.Selected.Value
    )
);
Set(
    endTime,
    If(
        DateValue(
            Text(
                selectedEndDate, "dd/mm/yyyy"
            )
        ) < DateValue(
            Text(
                selectedDate , "dd/mm/yyyy"
            )
        ),
        DateTimeValue(
            Text(
                selectedDate, "dd/mm/yyyy"
            ) & " " & ddTimeTo.Selected.Value
        ),
        DateTimeValue(
            Text(
                selectedEndDate, "dd/mm/yyyy"
            ) & " " & ddTimeTo.Selected.Value
        )
    )
);

 

Here is the filter for displaying the desks:

 

Sort(Filter(
    Desks,
    Not(
        Title in Filter(
            'Desk Reservations',
            CheckOutFromNumber>= Value(
            Text(
                startTime,
                "yyyymmddhhmm"
            )
        ) && CheckOutToNumber <= Value(
            Text(
                endTime,
                "yyyymmddhhmm"
            )
        ) || CheckOutFromNumber <= Value(
            Text(
                endTime,
                "yyyymmddhhmm"
            )
        ) && CheckOutToNumber >= Value(
            Text(
                endTime,
                "yyyymmddhhmm"
            )
        )
        ).DeskText
    ) && Active = 1 && Floor = ddFloor.Selected.Value 
),Title)

 

And here is the code for adding the selected desks into the SharePoint List so you know the format it's going in as:

 

orAll(
    selectedDesks,
    Patch(
        'Desk Reservations',
        Defaults('Desk Reservations'),
        {
            Title: currentUser.FullName & " " & ThisRecord.Title,
            DeskText: ThisRecord.Title,
            CheckOutFrom: DateAdd(selectedDate, "dd/mm/yyyy"),
            CheckOutFromText: Text(selectedDate, "dd/mm/yyyy") & " " & ddTimeFrom.Selected.Value,
            CheckOutFromNumber:Value(Text(selectedDate,"yyyymmddhhmm")),
            CheckOutTo: DateAdd(selectedEndDate, "dd/mm/yyyy"),
            CheckOutToText: Text(selectedEndDate, "dd/mm/yyyy") & " " & ddTimeTo.Selected.Value,
            CheckOutToNumber: Value(Text(selectedEndDate,"yyyymmddhhmm")),
            ReservedBy: currentUser.Email
        }
    )
);

 

Any ideas why the behaviour is so different between the two platforms?

 

Thanks

 

David

1 REPLY 1
Victoria
Kudo Kingpin
Kudo Kingpin

Hi. Did you get to the bottom of this? I have the same issue. Thanks, Vicki

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,156)