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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Screens resets to firs...
Power Apps
Unanswered

Screens resets to first equipment order instead of the order selected when navigate back

(0) ShareShare
ReportReport
Posted on by 383

I have a first gallery screen where I select an order to review.

 

Then I have a second gallery screen that shows the list of equipment for that order selected.

 

After navigating away from the second gallery and coming back to the equipment listed for the order there, it resets to whatever equipment is in the first order, instead of whatever order was originally selected from first gallery. All screens previously also reset to have the first order information too, instead of the order originally selected. Why does all the screens reset to the first order all the time after navigating back?

 

 

Additional information describing the screens set up:

The second gallery items are a join of two tables to be viewed in the gallery and filtered by the Order Number data value on the previous screen.

The first gallery item is a join of two tables as well.

The screens in between the items are based on a conditional LookUp based on what Order ID was selected from the first gallery.

The first gallery is from either the customer view screen or the internal team view screen where an Order ID is selected. The screen is depended whether the user email is part of the permissions table on SharePoint for the internal team list.

 

Items property for screens after initial gallery screen:

 If(!IsBlank(LookUp(Permissions,Email=User().Email)),LookUp(Orders,ID=Gallery3_TeamSearch.Selected.ID),LookUp(Orders,ID=Gallery3_CustomerSearch.Selected.ID))

 

None of the screens reset to the first order until after I go past the second gallery screen for the equipment for the order and navigate back. If I navigate in between screens before the equipment listed for the order, the screens do not reset to the first order yet.

 

What I think the problem is:

It seems to be the second gallery of the equipment listed for the order that makes everything reset when I go back to that screen. The gallery has 14 LookUps to join columns from two different tables in the item property for that gallery. Perhaps that's taking up too much memory, so when navigating back to that screen it resets as well as all the previous screens.


Any insight to my problem and how to solve it will be appreciated.

 

 

Categories:
I have the same question (0)
  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Based on the information you provided, it seems that the issue you're facing is related to the data context being reset when navigating back to the second gallery screen. To maintain the selected order and its associated equipment, you can try the following steps:

    1. Ensure proper navigation: Verify that you are using the appropriate navigation function to go back from the second gallery screen to the first gallery screen. The Back() function is commonly used for this purpose.

    2. Preserve the selected order: When navigating from the first gallery screen to the second gallery screen, ensure that you pass the selected order's ID as a parameter. For example, when navigating to the second gallery screen, use a formula like this:

    Navigate(SecondGalleryScreen, ScreenTransition.Fade, {SelectedOrderID: FirstGallery.Selected.ID})

    Set the gallery's default item: On the second gallery screen, configure the gallery's Default property to retrieve the selected order's ID from the parameter passed during navigation. For example:

    Default: First(Filter(Orders, ID = SelectedOrderID))

    Filter the equipment gallery: Use the selected order's ID to filter the equipment gallery on the second gallery screen. Modify the Items property of the equipment gallery as follows:

    Items: Filter(Equipment, OrderID = SelectedOrderID)

    By implementing these steps, the second gallery screen should retain the selected order and display the relevant equipment associated with that order, even when navigating back from subsequent screens.

    Regarding your concern about memory usage, it's unlikely that the LookUp functions in the second gallery's Items property are causing the issue. Power Apps can handle complex formulae efficiently. However, if you have a large dataset, it's a good practice to filter and paginate the data to optimize performance.

    Please give these suggestions a try, and let me know if you need further assistance!

  • Kirsten2 Profile Picture
    383 on at

    Thank you for your help!

     

    I did the following:

     

     

    Navigate('Screen4 - Order Review (Shopping Cart)',ScreenTransition.Cover, {'Order Number ':Text(If(!IsBlank(LookUp(Permissions,Email=User().Email)),Gallery3_TeamSearch.Selected.ID,Gallery3_CustomerSearch.Selected.ID))})

     

    This navigates to the second gallery screen of the equipment listed. I have to do a conditional on which 1st gallery screen I am using depending on who is accessing the application: customer versus internal team member. The internal team member will be listed on the SharePoint list, Permissions.

     

    Next, I did the following for the default value of the second gallery:

     

     

    First(Filter(Orders, 'Order Number '=Text(If(!IsBlank(LookUp(Permissions,Email=User().Email)),Gallery3_TeamSearch.Selected.ID,Gallery3_CustomerSearch.Selected.ID))))

     

     Here I get a delegation warning: 

     

    "The 'Text' part of this formula might not work correctly on large data sets."

    "Invalid formula. Expected a value compatible with 'Items'."

     

    Then for the Item property, which consists of a lot of lookups because I am combining two tables into one view, I did the following:

     

     

    Filter(
    
    
    
    AddColumns(Equipment As Main,"P1_49Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 1-49',"P50_99Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 50-99', "P100_199Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 100-199',"P200_299Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 200-299',"P300_399Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 300-399',"P400_499Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 400-499',"P500_999Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 500-999',"P1000_1499Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 1000-1499',
    "P1500_1999Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 1500-1999',
    "P2000_2999Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 2000-2999',
    "P3000_3999Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 3000-3999',
    "P4000_5999Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 4000-5999',
    "P6000_9999Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 6000-9999',
    "P10000Details",LookUp(Prices,'Part Number'=Main.'Part Number').'Unit Price 10,000+')
    ,'Order Number '= Text(If(!IsBlank(LookUp(Permissions,Email=User().Email)),Gallery3_TeamSearch.Selected.ID,Gallery3_CustomerSearch.Selected.ID))
    
    )

     

     

    I think I followed your directions correctly, but I have a delegation warning for the default value of the second gallery from using a Text function. Do you know how to get around that? Otherwise I am getting no error messages. 

  • Kirsten2 Profile Picture
    383 on at

    @WarrenBelz do you have experience with forms/galleries resetting when navigating back? It's like the session is timing out. 

  • Verified answer
    Kirsten2 Profile Picture
    383 on at

    Never mind! I found a solution that works. I used global variables to set Gallery3_TeamSearch.Selected.ID and Gallery3_CustomerSearch.Selected.ID instead. The forms stopped resetting when using a global variable. Not sure why it wasn't working in the first place, but this solved the issue. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard