cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ryder
Helper III
Helper III

How to filter a gallery via a search bar by mentioning the date

Hello,

which formula will allow me to filter the recordings by indicating a date?

 

Screenshot_20.png

 

the entity containing the records and the "date" field:

Screenshot_21.png

 

the gallery that I'm going to filter:

Screenshot_22.png

Thanks for your help,

15 REPLIES 15
eka24
Community Champion
Community Champion

What you show in the screen shot is patient Of. That is already included in the formula. Check my last reply

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

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 @eka24 ,

 

Yes, I used your formula. Here are the mistakes it showed me.

  • TextBox1.Text : The name is invalid, this identifier is not recognized.
  • Text : The "text" function contains invalid arguments
  • && :Text is expected.We are expecting text at this stage of the formula.

Screenshot_2.png

 

eka24
Community Champion
Community Champion

Insert a Textbox and name it TextBox1.Text .

If you give it another name the replace TextBox1.Text  with that name

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

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.

The errors come from you formula which is wrong. So the first condition is not a separate line here, but part of the rest of the formula.

Know that a comma in the formula is like an And by itself, so it is smart to use comma's to separate the individual conditions. This will make formula's easier to read and also when the first condition results in a false will stop the second condition to run.

For your case this would result in:

 

 

Sort(
    Filter(Consultation
        ,Patient_ID=TextBox1.Text
        ,Or(IsBlank(DatePicker1.SelectedDate), Text(Date,ShortDate)=Text(DatePicker1.SelectedDate,ShortDate))
    )
    , Date
    , Ascending
)

 

What the Or() does in the second condition is first to check on the data picker being blank and if this is the case results in a true always. 

 

Hope this helps.

hi @KroonOfficeSol @eka24  ,

 

I inserted the textbox and renamed it like you told me @eka24 

 

then I inserted the formula of @KroonOfficeSol  , I have no more errors but nothing is displayed as a result.

 

I have a question for honesty I did not understand, the textbox is supposed to return what as information ?

 

Screenshot_4.png

 

Thank you for your help,

That your gallery is empty is logic, this because the textbox is probably empty. So there is no match I would expect.


Also, I could imagine you would like to change the first condition to something like StartsWith(), because else there will only be a match on the full name.

 

Then you come to the next problem here, let's say you have more record on one patient and there is a typo in the name. This then won\t show up. So basically you probably want to create a patient entity with a one to many relationships to the Consultation entity.

 

Also, I see an orange triangle, what does this say?

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,381)