Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Filter based on Datepicker not working and no error as

(0) ShareShare
ReportReport
Posted on by

I am trying to use the below code to filter my data based on several field, in which I am selected From date and To date from date picker which i inserted, but it is not working , neither it is producing error, therefore cannot understand reason

 

Note :  I tried "DeliverFromDate_1.SelectedDate"   instead of   "DeliverFromDate_1.Value", but underlined red color, but when it is value, then it is not red.

 

Please advise correction of writing these types of code

 

 

 

Filter(
 colAllList,
 (
 Len(HoldModel.Value) = 0 ||
 HoldModel.Value in Model
 ) &&
 (
 Len(HoldSerial.Value) = 0 ||
 HoldSerial.Value in Serial
 ) &&
 (
 Len(HoldCustomer.Value) = 0 ||
 HoldCustomer.Value in CustomerName
 ) &&
(
 Len(DeliverFromDate_1.Value) = 0 ||
 DeliverFromDate_1.Value >= DelDate
 
 ) &&
( Len(DeliverDateTo_1.Value) = 0 ||
 DeliverDateTo_1.Value < DelDate+1
 )


 )

 

 

 

My screen image  is as below for your fast reference

MIA27_0-1708538209916.png

 

My screen image of my table in teams of that field is as below for quick reference

MIA27_0-1708538497823.png

 

 

  • MIA27 Profile Picture
    on at
    Re: Filter based on Datepicker not working and no error as

    Dear,

    Going further for test number of records, just to focus on collecting and supplying date for the filter, I removed all and kept the code in this way, No error BUT not proper result, while in the images you can see it is fetching the start date correct and end date correct from the data base, then if i keep both the field blank it should bring the result 4556, while it bring only 818 records. 

    Cannot understand the mistake, taking the target to fix code first and then further.

     

    Please guide as this fix and method has to be applied in several screen

     

    Filter( colAllList,
    (DelDate >= If(IsBlank(DeliverFromDate_1), First(SortByColumns(colAllList, "cr333_deldate", SortOrder.Ascending)).DelDate, DeliverFromDate_1.Value)) &&
    (DelDate <= If(IsBlank(DeliverDateTo_1), First(SortByColumns(colAllList, "cr333_deldate", SortOrder.Descending)).DelDate, DeliverDateTo_1.Value))
    )

     

    MIA27_0-1708584658905.png

     

     

    MIA27_2-1708584695694.png

     

     

  • MIA27 Profile Picture
    on at
    Re: Filter based on Datepicker not working and no error as

    In my case as the database exist, No need now,

    we can use

    if blank Then lookup the Minimum for the start date else the date picker date

    If blank then lookup the maximum for the end date else the date picker date

     

    Its just an idea which I use in MS access programming 

  • MIA27 Profile Picture
    on at
    Re: Filter based on Datepicker not working and no error as

    I was just reading in some search in google to add If with the date criteria with some blank result

    I mean IF isblank(datepicker field) then NOW() Else the datepicker date

    Can some thing will work, please guide 

     

  • MIA27 Profile Picture
    on at
    Re: Filter based on Datepicker not working and no error as

    sorry, copy and paste complete code.

    No Error No records

     

     

  • ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: Filter based on Datepicker not working and no error as

    @MIA27 I have edited my response.

     

    Thanks,

    ANB

  • MIA27 Profile Picture
    on at
    Re: Filter based on Datepicker not working and no error as

    copied and pasted your complete advised code 

    Same no error no result

  • Verified answer
    ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: Filter based on Datepicker not working and no error as

    @MIA27 Please use IsBlank for other controls too instead of Len function

     

     

    Filter(
     colAllList,
     (
     IsBlank(HoldModel) ||
     HoldModel.Value in Model
     ) &&
     (
     IsBlank(HoldSerial) ||
     HoldSerial.Value in Serial
     ) &&
     (
     IsBlank(HoldCustomer)||
     HoldCustomer.Value in CustomerName
     ) &&
    (
     IsBlank(DeliverFromDate_1)||
     DeliverFromDate_1.Value >= DelDate
     
     ) &&
    ( IsBlank(DeliverDateTo_1) ||
     DeliverDateTo_1.Value< DelDate+1
     )
     )

     

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

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

    Thanks,
    ANB


  • MIA27 Profile Picture
    on at
    Re: Filter based on Datepicker not working and no error as

    I tried the advised code, as shown below

    Result - No Error No result (does not filter any records in the gallery, even if both the field is blank

    Filter(
     colAllList,
     (
     Len(HoldModel.Value) = 0 ||
     HoldModel.Value in Model
     ) &&
     (
     Len(HoldSerial.Value) = 0 ||
     HoldSerial.Value in Serial
     ) &&
     (
     Len(HoldCustomer.Value) = 0 ||
     HoldCustomer.Value in CustomerName
     ) &&
    (
     IsBlank(DeliverFromDate_1)||
     DeliverFromDate_1.Value >= DelDate
     
     ) &&
    ( IsBlank(DeliverDateTo_1) ||
     DeliverDateTo_1.Value< DelDate+1
     )
     )
    
  • ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: Filter based on Datepicker not working and no error as

    @MIA27 Please try this:

    (
     IsBlank(DeliverFromDate_1)||
     DeliverFromDate_1.Value >= DelDate
     
     ) &&
    ( IsBlank(DeliverDateTo_1) ||
     DeliverDateTo_1.Value< DelDate+1
     )

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

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

    Thanks,
    ANB


  • MIA27 Profile Picture
    on at
    Re: Filter based on Datepicker not working and no error as

    sorry, I should have mentioned,

    I am developing this app in Teams powerapp.

     

    On the screen I selected the insert - Date picker 

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard