cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tapesh
Continued Contributor
Continued Contributor

Date filter on gallery error

Hi i All following code on my gallery items, 

i already have sortby filed which is sorting with names, but i also want that this should sort based on date selected. 

 

The code does not show any error, but this is also not updating the gallery items according to the specific date selected. 

 

please note: the formula works on search items by name, and sort by ascending descending, but this is not working for datepicker1.selected date why? 

 

please see code below 

SortByColumns(
   Filter(
   'Petty Cash & GL Code',
   
   // here we are saying that the status variable must be "All",
   // which will then not filter any items, or else the status must match the variable
   StatusResult="All" || Status  = StatusResult,
   
   // here we are saying, the textbox text is a blank or else it must
   // additionally filter the above by EmployeeName based on the Textbox Text
   SearchBox.Text = "" || StartsWith('Full Name', SearchBox.Text) ||( Created =(DatePicker1.SelectedDate))
   ),
"Title",
If(SortDescending1, Descending, Ascending) 
) 

 

Please correct me if I'm wrong somewhere. thanks 

6 REPLIES 6
eka24
Super User III
Super User III

Kindly check the Format of created column, if its a text then convert the

DatePicker to text as well:

DateValue(Created)=DatePicker.SelectedDate)

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @Tapesh and @eka24 

I set up a test using a SharePoint file and was able to make it work by converting both sides of the formula to ShortDates using the Text() function. 

Filter(splList,Text(Modified,ShortDate)=Text(DatePicker1.SelectedDate,ShortDate))

 

eka24
Super User III
Super User III

As i said earlier the issue is the format difference between created and datepicker.

Therefore:

 

SortByColumns(

   Filter(  'Petty Cash & GL Code

   // here we are saying that the status variable must be "All",

   // which will then not filter any items, or else the status must match the variable

   StatusResult="All" || Status  = StatusResult,

   // here we are saying, the textbox text is a blank or else it must

   // additionally filter the above by EmployeeName based on the Textbox Text

   SearchBox.Text = "" || StartsWith('Full Name', SearchBox.Text) || Text(Created, "dd-mmm-yyyy") =Text(DatePicker1.SelectedDate, "dd-mmm-yyyy"))

   ),"Title",If(SortDescending1, Descending, Ascending))

 

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

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Tapesh
Continued Contributor
Continued Contributor

@eka24 @Drrickryp 

 

 

Please see the screent shot below, i guess this shows a delegation error and also this is not working the way it should, when i select the date its still same. 

 

Display.png

eka24
Super User III
Super User III

Change it to the option by @Drrickryp 

Text(Created, ShortDate) =Text(DatePicker1.SelectedDate, ShortDate)

Do you get same result

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

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

Tapesh
Continued Contributor
Continued Contributor

@eka24  yeah there is no change 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (42,257)