web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery by vari...
Power Apps
Answered

Filter Gallery by variable and Status Reason

(0) ShareShare
ReportReport
Posted on by 716

Hello Power Apps Community,

Can you help please... and I hope I can explain this correctly...

 

I am building a canvas app, using Dataverse for Teams.

I have two tables: "Employee" which is the parent table, and "Transaction" which is the child table.
So one "Employee" record to many "Transaction" records.

 

I have an Employee screen with a gallery showing all the Employee records.

I have two icons for each record, the icons are called "Open" and "Closed".

 

Search Employee Gallery.png


When I click the "Open" icon or the "Closed" icon, on the relevant "OnSelect" property, it takes me to another screen (Transaction) with another gallery for the child table: Transaction. 

The expression is this: 


Navigate
(
                ScreenEmployeeTransaction,
                ScreenTransition.None,
                {lclThisEmployee: galEmployeeSearch.Selected} 
)

When I land on the child screen and gallery (Transaction) I want to see all related Transaction records of the parent (Employee) record I selected in the previous screen. 
So on the gallery I filtered the Transaction "Items" property with the below expression: 
 
Filter(
         Transactions,
         'Employee Name'.'Employee' = lclThisEmployee.'Employee'

)

Again, this is working great. So if I select John Smith on the Employee gallery I move to the Transaction screen and gallery and just see John Smith's Transactions.

My request: After all that, what I'm now looking to do is:

1. If on the Employee screen, image at the top, I click on "Open" then when I navigate to the Transaction screen and gallery I only want to see John's Smith's Transactions with the Status Reason of "Active".
2. If on the Employee screen, image at the top, I click on "Closed" then when I navigate to the Transaction screen and gallery I only want to see John's Smith's Transactions with the Status Reason of "Inactive".

Any thoughts would be greatly appreciated. 

Garry

PS. Model-driven apps for Dataverse for Teams cannot come quick enough for me. Can't wait to leave these canvas apps behind! Haha.

Categories:
  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    Hi @GarryPope,

    Set the onSelect property of the Open/Close button to:

    Navigate(
                    ScreenEmployeeTransaction,
                    ScreenTransition.None,
                    {lclThisEmployee: galEmployeeSearch.Selected, selectedStatusReason:"Active" /"Inactive" } 
    )
    (choose Active / Inactive - based on the button you set it) 
    Based on this, change the filter for the second gallery to:
    Filter(
             Transactions,
             'Employee Name'.'Employee' = lclThisEmployee.'Employee' && 'Status Reason'=selectedStatusReason

    )

     

    Hope it helps !

  • CU01081947-0 Profile Picture
    716 on at

    Hello @gabibalaban,

    Thanks for replying. Especially on a Saturday. I really appreciate this. 
    So the first part worked on my Open or Closed button, which is great. 

    When I added the second expression to the Transaction gallery, I got the below error:

    "We can't evaluate your formula because the values being compared in the formula aren't the same type."

    Error on formula.png

     

    Any thoughts on this please? No worries if not.

    Garry

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @GarryPope 

    Most probably the error is due to the fact that your status reason column is a choice type one.

    Use ‘Status Reason’.Value instead.

     

  • CU01081947-0 Profile Picture
    716 on at

    Hello @gabibalaban,

    Thanks for replying again. Sorry, mate, but that didn't work.

    I wrote the expression like below:

     

    Filter(
    Transactions,
    'Employee Name'.'Employee' = lclThisEmployee.'Employee' && 'Status Reason'.Value = selectedStatusReason
    )
     
    But it still didn't work unfortunately. Sorry.

    Value error.png
     
    When I mouse over the .Value the error is Name isn't valid. This identifier isn't recognized.
    Thanks,
    Garry
  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @GarryPope 

    There is something I miss ... Can you show the table structure of Transaction table ? 

  • CU01081947-0 Profile Picture
    716 on at

    Hello @gabibalaban,

    It's most probably my terrible explanation. Thanks for all your help.

     

    Here's the Transaction table:

    Transaction table.png 

    Here's the relationship structure for the Transaction table.

     

    Transaction relationships.png

     

    Thanks very much,

    Garry

  • Verified answer
    CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @GarryPope 

    Auch ...please excuse me. I skip the part that you work with DataVerse.

    For Dataverse, the right formula is:

    Filter(
             Transactions,
             'Employee Name'.'Employee' = lclThisEmployee.'Employee' && 
             If (selectedStatusReason="Active",
                        'Status Reason'='Status Reason (Transactions)'.'Active',
                        'Status Reason'='Status Reason (Transactions)'.'Inactive'

              )

    )

    Once again sorry for inconvenince.

     

  • CU01081947-0 Profile Picture
    716 on at

    @gabibalaban Woohoo! Woohoo! Woohoo!

    You can't believe how happy you've made me. Thanks so much. And please don't apologise, you helped so much. 

    When I added the formula in it worked perfectly! The labels in the gallery were not populating, but I put an extra ) at the end of your formula and the labels populated with data. 

    Thanks so much for spending you weekend helping me. I really appreciate it. 

    All the best,

    Garry

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    Thanks @GarryPope ! I'll update my formula to reflect the right solution ...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard