cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hydrarian
Level: Powered On

How to use filter in DataTable

Hi there,

I'm creating a powerapp in which I want to display records of a CDS Entity. My problem is that I would like to insert InputText filters to display only some records. I tryed to use but I cannot find the correct syntax to do that. I tried Filter(DataTable1; TextInputNome.Text = cr5a8_primaryname) but it gives me syntax error.

Could you please show me some examples?

Here's what I have:

pa.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: How to use filter in DataTable

You're close to the solution. Instead of using DataTable1 as the first parameter of the Filter expression, you should use the name of your data source (your entity):

Filter(EntityName; cr5a8_primaryName = TextInputName.Text)

Hope this helps!

View solution in original post

3 REPLIES 3
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: How to use filter in DataTable

You're close to the solution. Instead of using DataTable1 as the first parameter of the Filter expression, you should use the name of your data source (your entity):

Filter(EntityName; cr5a8_primaryName = TextInputName.Text)

Hope this helps!

View solution in original post

Hydrarian
Level: Powered On

Re: How to use filter in DataTable

Thank you very much Carlos, you made my day! Can I ask you also how can I show all the rows while there is no filter? And how about using multiple filter?

Thanks again for your help, I think it could be very helpful for other people also.

Highlighted
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: How to use filter in DataTable

If there is no text in that text input, then you can use the If function:

If(
    TextInputName.Text = "";
    EntityName;
    Filter(EntityName; cr5a8_primaryName = TextInputName.Text))

Or an Or expression in the filter:

Filter(EntityName; TextInputName.Text = "" Or cr5a8_primaryName = TextInputName.Text)

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (3,996)