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

Search Date with Searchbar for gallery

 Hi,

 

So I have a search bar where users can type in a vessel to find the vessel they need.  I also want users to search a date so they can find that specific date they need.

 

The Item property for gallery is: 

SortByColumns(Search( '[dbo].[tbl_Dailynoon_Report]'; txtSearch_NoonReport.Text; "Vessel"; "Date"); "Date"; If(SortDescending1; Descending; Ascending))

 

This doesn't work, sadly. The column "Date" is the problem, because when I remove it, the searchbar works. Probably has something to do that "Date" isn't in Text, but I don't know how to fix that. 

 

I'm using SQL as a source, don't know if that matters.

 

Thanks for the help.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Saego

 

Could you please share a bit more about your SQL Table data source within your app?

Which type of the Date column in your SQL table? Is it a Date only type or DateTime type column?

 

The Date type from SQL Server can't work with PowerApps (a known issue), if possible, please switch to DateTime type. Please check the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Filter-and-Lookup-not-working-with-date-value...

 

I have made a test on my side, if you want to filter the records of your SQL table based on the date or the vessel that you typed within the TextInput control (search bar), I afraid that there is no way to achieve your needs in PowerApps currently.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @Saego

 

Could you please share a bit more about your SQL Table data source within your app?

Which type of the Date column in your SQL table? Is it a Date only type or DateTime type column?

 

The Date type from SQL Server can't work with PowerApps (a known issue), if possible, please switch to DateTime type. Please check the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Filter-and-Lookup-not-working-with-date-value...

 

I have made a test on my side, if you want to filter the records of your SQL table based on the date or the vessel that you typed within the TextInput control (search bar), I afraid that there is no way to achieve your needs in PowerApps currently.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @v-xida-msft,

 

Thank you for the quick answer. Yes, it's the type 'Date' so not 'DateTime' in SQL.

I'll try to change it to DateTime and I'm going to check if that works. 

Thanks for the help. 

So I changed it and have two problems now.

In SQL, the datetime for a certain field is now 2018-01-01 00:00:00.000, while in Powerapps it's 2018-01-1 01:00. 

Is there a way to only show the date in Powerapps?

 

Then the second: 

My formula for Items Gallery is now:

SortByColumns(Search( '[dbo].[tbl_Dailynoon_Report]'; txtSearch_NoonReport.Text; "Vessel"; "Date"); "Date"; If(SortDescending1; Descending; Ascending))

 

It still doesn't work. I'm sure that I need to convert the "Date" from DateTime to text in Powerapps, but I don't know how.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,788)