cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Filter in an App with two timepicker

hello everyone

 

i'm sorry in advance if this is not the right place to post my issue. Its my first post here and my first experience with SP and Power Apps.

 

So, in advance of the issue i would like to present you my initial position and my goal: 

I've created a list in SP and made an app out of it with Powerapps. The list contains absences of coworkers which can be approved or declined within an workflow (the workflow i'm gonna to tackle in another post). The goal of the app is to display all entries. By default i can filter / search in the entries with this function:

SortByColumns(Filter([@Abwesenheiten]; StartsWith(Title; TextSearchBox1.Text)); "Title"; If(SortDescending1; Descending; Ascending))

 

Now, one problem is, at that moment, this filter / search is looking for the title of the coworker (like Employee or Management), but i want it to search for the name. Additionally to that, i want the outcome to be able to be filtered by two datepickers (Show me all people which have created an entry within the time frame between the two datepickers).

 

My list is called: Abwesenheiten

My columns are called: CreationDate, CreationDateNr, Title, Name, Color, ID, Reason, Start, End, Principal, Status, ApprovalWorkflow, Comment, Approval, ApprovalState.

 

Thank you very much in advance for your support. Best regards!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Filter in an App with two timepicker

Hi @FirstTry 

Note a couple of things here on this code: -

  • 'Created' is not Delegable so this will be an issue on large data sets.
  • Name is not a good title for a field as it is a Reserved Word in Power Apps.
SortByColumns(
   Filter(
      [@AbsenceManager], 
      StartsWith(
         Name, 
         TextSearchBox1.Text
      ) &&
      'Created' >= YourStartDatePicker.SelectedDate &&
      'Created' >= YourFinishDatePicker.SelectedDate
   ),
   "Title", 
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

9 REPLIES 9
Highlighted
Super User II
Super User II

Re: Filter in an App with two timepicker

What is the Name column being used for in your data source? If it's the employee's Name, then just swap that in your formula.

 

SortByColumns(Filter([@Abwesenheiten]; StartsWith(Title; TextSearchBox1.Text)); "Name"; If(SortDescending1; Descending; Ascending))

 

SharePoint is finicky with delegation, and unfortunately it does not support Date Filtering. That being said, how many rows do you expect to have in your SharePoint list? Do we need to show them all, can we collect a subset for use in the app? Once collected, then we can easily interact with her collection locally.

 

https://docs.microsoft.com/en-us/connectors/sharepointonline/#power-apps-delegable-functions-and-ope...

Highlighted
Regular Visitor

Re: Filter in an App with two timepicker

First of all: Thank you so much for your support!

 

I've read already alot about that delegation issues. But i think my table isn't affected, since it has only 11 rows and around 10 columns. I've just added the list and a picture of the PowerApps screen i'm using for you. 

I've tried it with Title1 or Subtitle1 aswell. Didn't work for me and i'm feeling dumb...

 

Thanks again and wish you a nice day!

Highlighted
Regular Visitor

Re: Filter in an App with two timepicker

Hey everyone,

Thank you very much for your help so far.

I am now able to search with a text field by name. But i am still not able to filter by the two date pickers which i've implemented.

I'd appreciate any help.

Here you can see my actual list:

1.png

Here is how the app is looking followed by the actual programm code in the search field:

2.png

SortByColumns(Filter([@AbsenceManager], StartsWith(Name, TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

How can i filter the displayed people by the day which is shown after "Created:" and by the text field with which i can filter already?

Thank you in advance!

Highlighted
Regular Visitor

Re: Filter in an App with two timepicker

Good morning everyone.

 

If any could support / help me with this, i'd be very grateful 🙂

@GarethPrisk 

@iAm_ManCat

@WarrenBelz 

 

Wish you all a nice and successful day!

 

Best regards.

Highlighted
Super User III
Super User III

Re: Filter in an App with two timepicker

Hi @FirstTry 

Note a couple of things here on this code: -

  • 'Created' is not Delegable so this will be an issue on large data sets.
  • Name is not a good title for a field as it is a Reserved Word in Power Apps.
SortByColumns(
   Filter(
      [@AbsenceManager], 
      StartsWith(
         Name, 
         TextSearchBox1.Text
      ) &&
      'Created' >= YourStartDatePicker.SelectedDate &&
      'Created' >= YourFinishDatePicker.SelectedDate
   ),
   "Title", 
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Highlighted
Regular Visitor

Re: Filter in an App with two timepicker

You are so awesome! Thank you so so much. I've spent so much time with this issue, and you got it solved for me now! Thank alot!

I just had to make a few small changes to the code you've sent to me, maybe you can explain me, why it does work now / what was the matter before?

Ofc i had to change the DatePicker names. That was no problem at all. But i've had issue with the 'Created'. I first changed it to Created (The same way i was able to search by name). It did filter then, but i think it filtered for the "real created" date, which means the time the item was created. The Created field i wanted to use, is the Created field in my list, which can be given by the user himself. Now, when i use 'Created (avby)' it works. Do you know if my assumption is right or is there another reason that it didn't sort / filter it right when i tried with Created only?

 

SortByColumns(
Filter(
[@AbsenceManager],
StartsWith(
Name,
TextSearchBox1.Text
) &&
'Created (avby)' >= DatePicker1.SelectedDate &&
'Created (avby)' <= DatePicker1_1.SelectedDate
),
"Title",
If(
SortDescending1,
Descending,
Ascending
)
)

Again, thank you so much for your help! And ofc i wish you a nice day 🙂 

 

Best regards.

Highlighted
Super User III
Super User III

Re: Filter in an App with two timepicker

Thanks @FirstTry ,

I assumed you wanted the first created date and my code was for this, so if this is another field, your current code is exactly what you need.

 

Highlighted
Regular Visitor

Re: Filter in an App with two timepicker

Oh, i see. I am sorry if i was not clear enough 🙂 .

 

Thank you very much for your help / support again. Unfortunately, i just have another issue right after i could fix the date filter. I can easily add a new line to my list in SP, and it will get displayed in the app. I can filter with dates and names, everything works fin. But when i want to add a new line to my list from the app, there's a error message:

avby: field 'avby' is required

 

If i click on: Edit in the formula bar, i get to the field IconAccept1, where the formula is: SubmitForm(EditForm1)

Do you know that issue? I got no idea where that is coming from or what additional information i need to give u so that u could help me in case u know what the issue could be about.

 

Thank you alot and wish you a nice day.

 

Best regards.

Highlighted
Super User III
Super User III

Re: Filter in an App with two timepicker

@FirstTry,

Go to your SharePoint list and into List Settings, choose the field and select No in Require that this column contains information:

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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