Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Bi50zwoe80Bw5pmvQfQnCL
Power Apps - Building Power Apps
Answered

Search and pre-populate form fields in PowerApps

Like (0) ShareShare
ReportReport
Posted on 23 Oct 2020 19:29:58 by 227

Hi,

 

I have 4 screens in my PowerApps. DataSource is Excel Table.

 

Screen1 contains Gallery tiles of systems, say "Sys1","Sy2","Sy3". When Clicks on any Gallery tile, it navigates them to Sceen2 which contains, instrument summary, also screen 2 contains information about system status [Available,In Use,OOS].

 

When user selects the system that is "Available", it displays 3 buttons on Screen 2 "Signup","Update Status" and "Cancel". When user selects "In Use" or "OOS", it displays only 2 button on screen2 "Update Status" and "Cancel".

 

OnSelecting "Signup" button on Screen 2 user navigates to Screen3, where user can put relevant information,and signup for the instrument. One of the column that is unique in this form "User ID" in text form (ex:john1)

 

When User Selects "Update Status" button from Screen 2, user navigates to Screen4. Where user can update the status of the system. I would like to allow end user to search for their ID and would like to pre-populate the edit form fields.

 

Ex: Let's say John wants to update the Status of Sys1 because he signed up for Sys1.When John clicks on Update Status it navigate him to Screen4, where he can enter his User ID and the fields such Model#,System# will be AutoPopulate for him. The only thing left form him will be to select correct system status from dropdown, and on submitting the button the status field will be populated in Excel Table.  

 

Note I would like to Auto-populate field based on only last Entry by John.

 

I am not sure how to achieve this in PowerApps.

Any help is appreciated!

 

 

  • ehr Profile Picture
    26 on 15 Jan 2021 at 14:47:00
    Re: Search and pre-populate form fields in PowerApps

    Brilliant! That worked perfectly. Thank you so much for all of your help and time!

  • dariobois Profile Picture
    195 on 15 Jan 2021 at 12:33:28
    Re: Search and pre-populate form fields in PowerApps

    Hi!

     

    Did you try something like this?

     

    Patch(
     'Yearly Time Management',
     First(Filter('Yearly Time Management',ID = vLastRecordOfUser.ID)),
    	{
    		StandardHours:TextInput5_StandardHours.Text,
    		TargetPercent:TextInput5_Target.Text,
    		DirectLaborHours:TextInput5_Direct.Text
    	}
    )

     

    regards!

  • ehr Profile Picture
    26 on 14 Jan 2021 at 22:45:55
    Re: Search and pre-populate form fields in PowerApps

    Hi!

    I populate by adding vLastRecordOfUser.StandardHours as Default in the TextInput fields and my UpdateContext per your example is:

    UpdateContext(
    {
    vLastRecordOfUser: Last(
    Filter(
    'Yearly Time Management',
    Upper(EmployeeName) = Upper(TextInput5_Search.Text)
    )
    )
    }
    )

     

    And the Patch is as stated above.

  • dariobois Profile Picture
    195 on 14 Jan 2021 at 21:05:42
    Re: Search and pre-populate form fields in PowerApps

    Hi!

    you are rigth with the commas!

     

    you can edit just the columns you need to. How did you "populate" the vLastRecordOfUser variable? before you updates its fields. 

  • ehr Profile Picture
    26 on 14 Jan 2021 at 20:33:40
    Re: Search and pre-populate form fields in PowerApps

    I still get a second line entry. I got an error on the first semi-colon so I changed it to a comma and the error resolved. Here's the beginning of my Patch: 

    Patch('Yearly Time Management',vLastRecordOfUser;{StandardHours:TextInput5_StandardHours.Text,TargetPercent:TextInput5_Target.Text,DirectLaborHours:TextInput5_Direct.Text, ...

     

    Does vLastRecordOfUser need to proceed each column/text field?

  • dariobois Profile Picture
    195 on 14 Jan 2021 at 20:15:05
    Re: Search and pre-populate form fields in PowerApps

    Ok, so, to update an item, just put the "object Item" as a second parameter of Patch formula

     

    Continuing with my previous example:

     

     

    UpdateContext(
     {
     vLastRecordOfUser: Last(
     Filter(
     Systems,
     Upper('User') = Upper(TextInput1.Text)
     )
     )
     }
    )

     

     

    You can use the patch Formula, like this:

     

     

    Patch(
     Systems,
     vLastRecordOfUser,
     {model: "test"}
    )

     

     

  • ehr Profile Picture
    26 on 14 Jan 2021 at 20:03:15
    Re: Search and pre-populate form fields in PowerApps

    Yes!

  • dariobois Profile Picture
    195 on 14 Jan 2021 at 19:57:34
    Re: Search and pre-populate form fields in PowerApps

    Hi!

    Are you using "Patch" Function to update the item?

  • ehr Profile Picture
    26 on 14 Jan 2021 at 19:53:14
    Re: Search and pre-populate form fields in PowerApps

    Actually, @dariobois - do you know how I would tie this Filter to the list item ID in Sharepoint so I'm updating an existing line of data and not creating a new one?

  • ehr Profile Picture
    26 on 14 Jan 2021 at 19:40:25
    Re: Search and pre-populate form fields in PowerApps

    Great to know! Thanks for the information. Sounds like I won't be bothered by this in this app since I won't be likely to exceed 2K. 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 42 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 36

Overall leaderboard
Loading started