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 / Trouble populating fie...
Power Apps
Answered

Trouble populating fields when navigating

(1) ShareShare
ReportReport
Posted on by 84
I have a Comment screen that gets navigated to in two different ways, once form a landing page, and once from another screen where people can review previously edited info. When they navigate to the screen from the landing page, there is a form with an Order number datacard that is populated by sorting orders from a SharePoint list. When they're on the review screen, there is a gallery where they can select an Order, and then a form next to it that is populated with various information like order, etc, as shown below. 
 
When the users click on the 'Post a comment' button above, what I want to happen is to navigate to the Comment screen, and in the form that'a on the Coments scree have the Order field be automatically populated with the Order that's been selected in the gallery/populated in the form. I've tried creating local variables for the selected_po but it's not working. Any help would be appreciated.  
Categories:
I have the same question (0)
  • Suggested answer
    Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at
    Hey mterry,
     
    Since you naviagte away from the screen a local variable will not help. 
    You can only use them when you stay on the specific screen. 
     
    You would need a global variable to get it done.
    Set(varItem,Gallery.SelectedItem)
    For example or replace Gallery.SelectedItem with what you have in the forms item property. 
     
    If this solvede your porblem please accept it as solution so others can find it as well. 
    If it helped in any other way consider liking it so we can keep supporting eachother. 
  • mterry Profile Picture
    84 on at
    Thank you that worked, and I can see the correct order number being passed to the new screen cause I created a text box to test. Now my problem is getting that variable to populate the combo box when navigated to from one screen, and getting the unique list from the sharepoint list when navigating from the landing screen. I tried to set a variable when clicking the button from the landing screen: 
    Set(varScenario, 1);NewForm(frmComment);Navigate(Comment)
     
    Then another scenario when navigating from the Reply screen:
    Set(selected_po, galPOHolds.Selected.PO_Number); Set(varScenario, 2);NewForm(frmComment);Navigate(Comment)
     
    Both those seem to work fine (again testing with text boxes), but the syntax for the Item property of the combo box is giving me an error:
    If(varScenario=1,Sort(Distinct(po_holds,PO_Number),SortOrder.Ascending),selected_po)
     
    Thanks for your help!
  • Suggested answer
    Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at
    Hey I would try it like this:
     
    Scenario 1:
    Set(varScenario, 1);
    NewForm(frmComment);
    Navigate(Comment)
     
    Scenario 2:
    Set(selected_po, galPOHolds.SelectedItems); 
    Set(varScenario, 2);
    NewForm(frmComment);
    Navigate(Comment)
    Combobox
    If(varScenario=1,Sort(Distinct(po_holds,PO_Number),SortOrder.Ascending),selected_po)
    This will result in you being able to choose from the selected values of Scenario 2 if you xant them to be selected you have to put it in the Property SelectedITems and Default. 
  • mterry Profile Picture
    84 on at
    Set(selected_po, galPOHolds.SelectedItems) is causing an error. It says "Incompatiple type. We can't evaluate your formula because the context variable types are incompatible with the types of values in other places in your app." Name isn't valid. SelectedItems isnt' recognized. However, set(selected_PO, galPOHolds.Selected.PO_Number) does not cause an error and appears to be working correctly becuase I placed a text box to test on the Comment page and when I navigate there it is populated accurately (did the same with the varScenario variable and it appears to work correctly too). So the only issue is with the syntax in the ComboBox Items property:
    If(varScenario=1,Sort(Distinct(po_holds,PO_Number),SortOrder.Ascending), selected_po)
    The above gives an error, it says data type. 
  • Verified answer
    ronaldwalcott Profile Picture
    3,862 Moderator on at
    In 
    If(varScenario=1,Sort(Distinct(po_holds,PO_Number),SortOrder.Ascending), selected_po)
     
    Use selected_po to lookup the value in the table so something like
    Lookup(tableName, PO_Number = selected_po) or Filter
    Replace selected_po in your If with this because the evaluation of the If needs to produce a record similar to the sort not a single value

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard