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.

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
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 (3,231)