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

Filtering Option - matching values in one-column tables

Hi all,

 

A little more of a complex question here - 

 

I have a table that I have set up a gallery for. This table has a few different columns - one such column is of datatype "table", so each row has a one-column table as a datapoint.

 

I'd like to compare this datapoint to a variable set in PowerApps that is also a one column table. The logic should be that if any of the values in the respective tables match, the row passes the filter.

 

Any idea on how to set this up?

 

Thanks,

Farhan

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @farhandsome :

This function can be achieved through the nesting of functions.I've made a test for your reference:

This is my test data——

'a table' -TestTable:

 

ClearCollect(
    TestTable,
    {
        ID: 1,
        TableColumn: Table({Value:1},{Value:2},{Value:3})
    },
    {
        ID: 2,
        TableColumn: Table({Value:5},{Value:2},{Value:3})
    },
    {
        ID: 3,
        TableColumn: Table({Value:7},{Value:3},{Value:9})
    },
    {
        ID: 4,
        TableColumn: Table({Value:1},{Value:8},{Value:9})
    }
);

 

a variable set in PowerApps-var:

 

Set(var,Table({Result:1},{Result:2}))

 

This is my solution——

1\Add a gallery and set it's items property to:

 

Filter(
    TestTable,
    ID in Ungroup(
        ForAll(
            var,/*Iterate over the variable var*/
            Filter(
                TestTable,
                Result in TableColumn
            )/*Filter out all eligible records*/
        ),
        "Value"   /*The running result of the ForAll function will be stored in a single list with the column name "Value".So the "Value" must be ungrouped.*/
    ).ID /*Because this operation will generate a large number of duplicate records (so the result cannot be used directly), we only get the unique identifier ‘ID’ and then use it to filter the TestTable*/
)

 

2\Add a sub-gallery into this gallery

Items:

 

ThisItem.TableColumn

 

1.JPG

Because there is no 1 or 2 in the TableColumn of the third record, it is not displayed.

Best Regards,

Bof

 

 

View solution in original post

1 REPLY 1
Community Support
Community Support

Hi @farhandsome :

This function can be achieved through the nesting of functions.I've made a test for your reference:

This is my test data——

'a table' -TestTable:

 

ClearCollect(
    TestTable,
    {
        ID: 1,
        TableColumn: Table({Value:1},{Value:2},{Value:3})
    },
    {
        ID: 2,
        TableColumn: Table({Value:5},{Value:2},{Value:3})
    },
    {
        ID: 3,
        TableColumn: Table({Value:7},{Value:3},{Value:9})
    },
    {
        ID: 4,
        TableColumn: Table({Value:1},{Value:8},{Value:9})
    }
);

 

a variable set in PowerApps-var:

 

Set(var,Table({Result:1},{Result:2}))

 

This is my solution——

1\Add a gallery and set it's items property to:

 

Filter(
    TestTable,
    ID in Ungroup(
        ForAll(
            var,/*Iterate over the variable var*/
            Filter(
                TestTable,
                Result in TableColumn
            )/*Filter out all eligible records*/
        ),
        "Value"   /*The running result of the ForAll function will be stored in a single list with the column name "Value".So the "Value" must be ungrouped.*/
    ).ID /*Because this operation will generate a large number of duplicate records (so the result cannot be used directly), we only get the unique identifier ‘ID’ and then use it to filter the TestTable*/
)

 

2\Add a sub-gallery into this gallery

Items:

 

ThisItem.TableColumn

 

1.JPG

Because there is no 1 or 2 in the TableColumn of the third record, it is not displayed.

Best Regards,

Bof

 

 

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,849)