cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Phil_NPO
Helper III
Helper III

Filter collection of shifts does not work

I want to get users who are working right now. 

 

So I started with

ClearCollect(col_shifts;ShiftsforMicrosoftTeams.ListShifts("xxxxxxx Team ID").value)

 

Filter(col_shifts;sharedShift.startDateTime<DateValue(Text(Now();UTC));sharedShift.endDateTime>DateValue(Text(Now())))

 

But in my gallery no items are shown. 

 

 

5 REPLIES 5
superfliege
Advocate II
Advocate II

It's really hard with your entire filter to tell you a solution here.


You can try to convert the data as a common format.
For Example on both sides you should convert to Text(DateTimeValue(ArrivalDateTime.Text), DateTimeFormat.LongDateTime)
Source: https://docs.microsoft.com/de-de/power-apps/maker/canvas-apps/show-text-dates-times

 

Of course you can also display the filter input for debugging in multiple text fields. This always helps me a lot when I want to compare values. Often I notice that a date conversion was wrong.

I hope this helps you.

 

I tried you some different DateTimeValues like you wrote. Maybe the problem is because of the dataset. 

 

I found an old thread https://powerusers.microsoft.com/t5/Building-Power-Apps/ShiftForMicrosoftTeams-I-can-only-see-the-ne... , there you can use StartTime and EndTime, but in my dataset i cannot find StartTime and EndTime directly. There is DraftShift and SharedShift with attributes like StartDateTime and EndDateTime. 

 

Is this the reason why I cannot filter? How can I get these Attributes like SharedShift.StartDateTime to add it to a new column?

Screenshot 2022-08-19 100425.png

 

superfliege
Advocate II
Advocate II

Yes it looks like you are not going to the date field value but somehow to another dataset.

Try to address here this dataset SharedShift.StartDateTime. after the point there should be more values here.

Often it works to put First() in front of it, but I don't know your data structure for that.

Try also to display your comparison values in labels.

Well, this is not my own dataset, it is the result of ListShifts.

 

After the point of SharedShift.StartDateTime there are no more values. 

 

Can you describe how to copy SharedShift.StartDateTime to a new column in the collection table?

superfliege
Advocate II
Advocate II

Oh sorry, I misunderstood something.

You can see how to copy the value to a new column here. You might also be able to use this to create a new collection and view the values directly. That should help you troubleshoot:

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-table-shaping

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 (4,552)