cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hydrarian
Frequent Visitor

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
CarlosFigueira
Power Apps
Power Apps

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
CarlosFigueira
Power Apps
Power Apps

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

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.

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (32,904)