cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to filter elements by date in Searchbar

Hello,

 

I am to filter elements by the date in my Searchbar.
I use an Excel spreadsheet as database. My table is called "Table1". I have a column called "Datum", which is storing dates.

What I tried(Items property of BrowseGallery) :

SortByColumns(
    Search (
        [@Table1];
        TextSearchBox1.Text;
        Text(Filter(Table1; TextSearchBox1.Text in Text(Datum).Datum);"dd.mm.yyyy")
        );
    "Datum";
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)


 Any Suggestions?

Best regards

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @Anonymous ,

Search function only works with Text fields, so you can add a new column to keep date column into text value.

I did a test on my side, you can refer to this formula:

SortByColumns(
    Search(
    AddColumns(
        Table1;
        "Textdate1";
        Text(
            Datum;
            "dd.mm.yyyy"
        )
    );
    TextSearchBox1.Text;
    "textdate1"
);
    "Datum";
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)

Best regards,

Allen

View solution in original post

5 REPLIES 5
CNT
Super User
Super User

@Anonymous Try this,

SortByColumns(
    Filter(
        [@Table1];
        If(!IsBlank(TextSearchBox1.Text), TextSearchBox1.Text in Datum, true)
      );
    "Datum";
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)
Anonymous
Not applicable

Hello, @CNT 

I tried the code, but the results are strange. When I write for example "08.04.2021" in the searchbar, it doesn't display the element which has the same date..

@Anonymous Is the date in the same format as "08.04.2021" ? Because we are doing a text search using in even when you type "08" it should show up.

Anonymous
Not applicable

@CNTin the spreadsheet it is saved as "08/04/2021" and when I type "08" nothing shows up...

v-albai-msft
Community Support
Community Support

Hi @Anonymous ,

Search function only works with Text fields, so you can add a new column to keep date column into text value.

I did a test on my side, you can refer to this formula:

SortByColumns(
    Search(
    AddColumns(
        Table1;
        "Textdate1";
        Text(
            Datum;
            "dd.mm.yyyy"
        )
    );
    TextSearchBox1.Text;
    "textdate1"
);
    "Datum";
    If(
        SortDescending1;
        Descending;
        Ascending
    )
)

Best regards,

Allen

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,081)