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

How can I filter a table based on the values in a column in another table?

Hi,

 

I want to filter a table based on values from another table. Both tables have a common column. When I try the following code it is showing an error "Cannot use Table values in this context!"

 

ClearCollect(
    MyAssignments,
    Filter(Table2,Table1.TaskID in Table2.TaskID)
    )

 

 

This is the table structure

Screenshot (376).png

 

Regards,

Aakash

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

In that use:

  ClearCollect(MyAssignment,
      Filter(Tabel2,TaskID in Tabel1.TaskID))

 

You can then use the Collection MyAssignment

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

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.

 

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

You can go around it as follows:

Insert a combobox1 and put table1 in the Items of the combobox.

 

Then you can filter as follows:
Filter(Table2,TaskID=combobox1.Selected)

 

OR

Insert a combobox1 and put table1.TaskID in the Items of the combobox.

    Filter(Table2,TaskID=combobox1.Selected.TaskID)

 

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

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.

Anonymous
Not applicable

@eka24  Combobox or any other manual input won't work for me. I need users to see a filtered list of the tasks they created on a click of a button. Filtering is happening with the help of collections and a final collection (resultant table) is being created and displayed on the next screen.

TaskID column from Table1 (which also has many other columns with information) should filter Table 2 (main database).
Screenshot (376).png

The following will be the resultant table (stored as a collection) which users need to see (information from different tables are being matched and getting displayed in a gallery).

Screenshot (377).png
Regards,
Aakash

eka24
Super User
Super User

In that use:

  ClearCollect(MyAssignment,
      Filter(Tabel2,TaskID in Tabel1.TaskID))

 

You can then use the Collection MyAssignment

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

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.

 

Anonymous
Not applicable

@eka24 it worked! Thanks mate!

 

Aakash

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 (1,831)