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 / Power Apps Gallery glo...
Power Apps
Unanswered

Power Apps Gallery global variable for two forms

(0) ShareShare
ReportReport
Posted on by 4

Hello Team 

 

I am new to power apps but have been building a power apps application. I have a gallery filter by the people on my organization as me as Manager. In the gallery arrow pointing to the right, which I change to an edit Icon, I set up a variable which looks like this:

 

Set(
    varEdituser,
    ThisItem
   
);
Set(
    varEdituser2,
    ThisItem
   
);
Navigate(Form2)
 
Then the application navigates to my form and uses varEdituser to filter the edit form to the information of the employee selected. So far so good. My idea was to set up varEdituser2 as well to filter with the same idea, the information on the edit form 3, which is on a different screen. But when I use the same approach and set up the form Item property to varEdituser2, it does not accept the variable and produces an error. Any idea how can I approach this?
 
Categories:
  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @Andrewcr88 just use the same global variable for both filters? It looks as if you are setting both variables to the same value so you could just use varEdituser twice and have this on your on select:

     

     

     

    Set(
     varEdituser,
     ThisItem
     
    );
    Navigate(Form2)

     

     

    Please click Accept as solution if my post helped you solve your issue. ✔️ This will help others find the solution to this problem. It also closes the item. Remember, you can accept more than one post as a solution.

    If the content was useful in other ways, please consider giving it Thumbs Up. 👍

    Thanks
    Andrew

  • Srirangamnipun Profile Picture
    30 on at

    Hi,

    you can set the value of varEdituser as a global variable so that it can be accessed from any screen within your app. Here's how you can do it:
    In the Gallery:
    Set( varEdituser, ThisItem ); Navigate(Form2)
    In the OnVisible property of the second screen:
    Set( varEdituser2, varEdituser );

    By setting varEdituser2 in the OnVisible property of the second screen, you ensure that it gets the value of varEdituser when the second screen is loaded.

    Make sure to update the Item property of your second form to use varEdituser2.

  • timl Profile Picture
    37,287 Super User 2026 Season 2 on at

    Hi @Andrewcr88 

    In addition to the above, if you can post the exact error when you set the Item property of Form3 to varEdituser2, we can advise further on why Form3 doesn't work.

  • Andrewcr88 Profile Picture
    4 on at

    I tried this solution, I changed the original gallery1 code to set up one variable only, there are 3 screens, 1 screen is where the gallery is, the second screen is where the first form is(the one working), and I set up the Set( varEdituser2, varEdituser ) on the third screen where the second form is,  but it keeps saying there is an error with the formula. 

  • Andrewcr88 Profile Picture
    4 on at

    The error I am getting is Invalid formula: expected a value compatible with data source. Both sharepoint lists are using the same information which is a username and email as key IDs and is working on the other form.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard