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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (26,114)