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 / How to dynamically set...
Power Apps
Unanswered

How to dynamically set "Item" property in "form" control

(1) ShareShare
ReportReport
Posted on by

I would like to set dynamically the item to be edited in a "form" control.

 

Usually the "item" property is set to "Gallery.Selected". 

 

Do I now need to change the gallery.selected data? Or can I directy set the value of the "Item" property?

 

Can I set "gallery.selected" or the "item" property by the "on select" event? If so, how?

Categories:
I have the same question (0)
  • Rebetcha Profile Picture
    645 on at

    In the item property there should be a reference to a record. What you could do is use a collection in which you store the item that you want to use on the form and reference that record in the 'item'-property. You need to add a clearcollect function to create the record in the collection to every part of the app from where you want to navigate to the 'form'-control. Of course the order of the function should be: first the clearcollect and second the navigate.

  • v-micsh-msft Profile Picture
    on at

    Hi @Anonymous,

     

    It is recommended to take a look at the following article first:

    Understand data forms in Microsoft PowerApps

     

    To have the Form control work property, we need to configure the DataSource property and the item property.

    Item property is one single record from the table configured under DataSource property.

    By default, the DataSource is not allowed to change once configured, but for the item property, we could take use of filter functions to find the proper record,

    For example (using Display form as an example):

    We have the following table as data source:

    96.PNG

    1. Data Source configured to 

    '[dbo].[Product]'

    2. Add a button, OnSelect property configured to: 

    UpdateContext({ProductID1:If(ProductID1>5,ProductID1-4,ProductID1+1)})

    3. Item property configured to : 

    LookUp('[dbo].[Product]',ProductID=ProductID1)

     

    When click the button, the item would change to the corresponding record:

    97.PNG

     

    EditForm is only available to configure the item property with Edit Mode, for more details, please check:

    Edit form and Display form controls in PowerApps

     

    Regards,

    Michael

     

  • Community Power Platform Member Profile Picture
    on at

    Thank you for this hint.

     

    I have implemented this and it worked well.

     

    I did the following:

    - created 4 screens (newPage1, newPage2, editPage1, editPage2)

    - Item property in NewForm1 and NewForm2 is empty

    - On the submit button I do the following (this is probably the complicated part):

     Patch(PowerAppsMultiPageDemo,Defaults(PowerAppsMultiPageDemo),{Title: DataCardValue9_1.Text,Feld1: DataCardValue10_1.Text},NewForm2.Updates);Navigate(BrowseScreen1,Cover)

     

    For the edit Pages it was slightly easier:

    - Item Property of EditForm1 and EditForm2 is set to "Gallery.Selected"

    - On submit I do the following:

     Patch(PowerAppsMultiPageDemo,BrowseGallery1.Selected,EditForm1.Updates,EditForm1_1.Updates);Navigate(BrowseScreen1,Cover)

     

     

     

    The only downside of it is that such an architecture is quite effortful. especially when it comes to changes, one always has to consider dependencies to the rules.

     

     

  • Community Power Platform Member Profile Picture
    on at

    Thankts for the second hint.

     

    I'm curious to see if this leads to an even simpler approach.

     

    I didn't know that I can filter the item property like this.

  • OrangeJuiceCup Profile Picture
    24 on at

    Thank you very much, Michael ()! That was just what I needed.

  • Community Power Platform Member Profile Picture
    on at

    You helped me a lot! Thanks! 🙂 

  • Patrick42 Profile Picture
    4 on at

    Similar question, but what should you set "item" as when you want to create a new item

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard