cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper IV
Helper IV

Search and pre-populate form fields in PowerApps

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!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi again!

 

In my example, the "magnifying glass" icon has the "OnSelect" property with this formula:

 

 

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

 

 

Note that the first parameter of Filter function, named "Systems" is  the excel table connection.

 

Then, in the "Default" property of  "System" and "Model"'s textinputs, set this formula:

 

 

vLastRecordOfUser.System

 

and

 

vLastRecordOfUser.Model

 

 

Verify that the name of each property, must be the same of your excel table structure:

 

dariobois_0-1603807375938.png

 

Regards!

 

View solution in original post

27 REPLIES 27
Resolver II
Resolver II

Hi!

 

You can try to get the last record, inserted by John, into a Context Variable, then, put each property of that Variable on the Default Property of each control.

 

Regards!

 

 

Frequent Visitor

Hey there!

 

As soon as A user enters its UserID you can call the functions to fetch your data and then set the variables.

For example Set(ModelDefault;whatever) in the OnChange function. And fill the Default property of your input with this variable "ModelDefault".

 

Then it should be solved!

Hi @dariobois,

 

If possible can you please we me through the steps ? I am new to PowerApps.

Context Variable ? Does it mean I do not need Search Box ?If I need searchBox, How would it work ?

 

Thanks in advance for your time!

Hey @kkowal,

 

If possible can you please walk me through the steps ? I am new to PowerApps.

Thanks in advance for your time!

Sure! Send us a picture of the controls you want to populate (included data) with the John's last entry example.

 

 

@dariobois

 

Thanks! Please see Updated Excel Table after John's Entry. The Pre-populated fields in Edit form will be System,Model and Pervious Status.Current Status will have dropdown where John will be able to put the system to Statues such as "Available" or "OOS"

 

Newbie12_0-1603503489820.png

 

Controls:

System: DataCardVal1

Model=DataCardValue2

'Previous Status'=DataCardValue3

'Current Status'=DropDown1.SelectedText.Value

 

Thanks again! 😊

Note: I am using Textinput for search. So the control will be Textinput1.

Hi!

@Newbie12 i can give you an approach of what i think you want to do.

 

First you need to define the User field as an ID, unique per user, the email for example.

 

Then, when User opens the screen4, in the "OnVisible" event get the last record generated by that user from the "Systems" Table of the excel connection, and keep it on a Context Variable (in the example behind, called "vLastRecordOfUser"). Just like this:

 

 

 

 

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

 

 

 

 

For each TextBox control of the Screen4, set the "Default" property with the corresponded field of vLastRecordOfUser, like this:

 

image.png

 

image.png

 

Tell me if it works,

Regards!

 

 

Hi @dariobois ,

 

Will the updatecontext go in the TextInput box visible property or in the Form visible property ?

 

I would like the end users to enter their UserID in textinput box and pre-poplulate their last entry.

 

Thanks in advance,

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,651)