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 / Variable within a Vari...
Power Apps
Answered

Variable within a Variable

(0) ShareShare
ReportReport
Posted on by 37

I have a Gallery that is accessed from several screens and I want it to update based on the information passed.  I set the Gallery Item as a variable "Cases".  I have four screens that navigate to this screen with the following variable onselect:Navigate(ClientCaseScreen,Transition.None,{Cases:SortByColumns(Filter('[dbo].[CaseTable]',ClientID=Client.ClientID), "IncidentDate", If(SortDescending2, Ascending,Descending))}) 

 

I get "The Function if has some invalid arugments" for the "If(SortDescending2, Ascending,Descending)"

 

I had it working for two of the screens but when I added a third screen it errored on all of them.

Categories:
I have the same question (0)
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    If the variable 'SortDescending2' is defined as local to a screen (using the UpdateContext function) then it can only be accessed from that screen. You can try changing it to a global variable: whenever you use the UpdateContext to set it, you change to use the Set function, which will define that variable in a way that it can be used in any screen.

     

    Another alternative is to navigate passing only the client id for which you want to filter:

    Navigate(ClientCaseScreen, Transition.None, {selectedClientID:Client.ClientID})

    And use the filter in the gallery within that screen:

    SortByColumns(
     Filter('[dbo].[CaseTable]', ClientID = selectedClientID),
     "IncidentDate",
     If(SortDescending2, Ascending, Descending))

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
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard