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

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!

 

 

27 REPLIES 27

Hi!

 

In that case you need a button or some event that trigger the action of get the last record, you can try something like this:

 

dariobois_0-1603748404980.png

The icon button has the formula to get the last record of the user wich ID is on TextInput1.Text, like this

 

 

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

 

 

Thanks @dariobois!

Where should above code go in the Textinput control ? Will it be in "OnSelect" or "Default" property ?

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

Hi @dariobois,

 

Thanks again! My form contains "Textboxes" instead of "TextInput". Do I need to convert each and every Textbox into TextInput box? If yes, will it impact the excel Update ? I plan to update Excel Table using Patch in submit button.

@Newbie12 just use the property Default of that textboxes, and verify the Patch Function still working.

 

 

@dariobois Thanks. It worked out fine!

 

Having an issue with Gallery Tile here. For some reason the appended rows in Excel Table are creating an extra tile for same systems. Any help will be appreciated! Thanks in advance!

ehr
Helper I
Helper I

@dariobois Thanks for this solution. It's working great for me to pull data back into my app from a Sharepoint list so users can update their previous record. I am getting a delegation warning on the Filter part of the code though. How do you recommend dealing with this?

Hi @ehr 

 

Delegation warnings mean that your formula might not work on large shared point list items, because the query is running locally.

If your sharepoint list exceeds 2k items, you will need to do some workarounds, for example,  populating the lists in a collection, multiple times to ensure the integrity of all items.

 

I recommend this post: Is there any way to read more than 5000 items from sharepoint list in powerapps 

 

regards!

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. 

ehr
Helper I
Helper I

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?

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (21,013)