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 / EditFrom function Disp...
Power Apps
Answered

EditFrom function Display Nothing

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I created a form and set the Default to FormMode.New

This allows the user to add new data when they land on my screen - works perfect

FormMode.NewFormMode.New

My button "+Add Item" creates a collection which gets shown in the gallery below with the idea that it lets user review the item before commiting it to sharepoint list - works fine

 

Now in the gallery I added the icon to change FormMode.Edit 

I have that gallery icon Onselect: Set(VarMode, "Edit"); Select(Parent)

And in my form the default I have an IF statement to check the variable  if true then FormMode.Edit  else FormMode.New

when this is click my form just goes blank " Nothing to display"

Capture2.PNG

 

FormMode.EditFormMode.Edit

I am stumped -  I think it has something to do with the form not being able to point to the record in the gallery but I don't know how to do that.

 

Could someone explain how I can achieve the edit function to display the selected item in the form from the gallery ready for change?

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

    This problem is usually caused by not having the correct formula in the Item property of the Form. Try putting this formula in the Item property of the Form.  Replace datasource and gallery in the formula with the name of your actual datasource and gallery.

    Lookup(datasource, ID = Gallery1.Selected.ID).  Make sure the datasource in the Lookup() is the same as the Data source property in the form.  The Lookup() ensures that you have found the correct record in the gallery to edit.

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 
    I think the reason can be traced back to the Default property of your form.  Typically, the form will show "no item to display" if the value supplied here is blank or does not match format the Form's datasource was expecting.

    Please try this method:

    In the OnSuccess property of the form use this code to create a variable.  It will hold the record information after it gets submitted.

     

    Set(varCurrentRecord, Form1.LastSubmit)

     

    Now put this code int the Item property of the Form.  This is the record that will be displayed when the Form is in Edit mode.

     

    varCurrentRecord

     

    Finally, use this code in the OnSelect property of your gallery edit button to change what record the form is displaying.

     

    Set(currentRecord, ThisItem);
    EditForm(Form1);

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    My data source for the gallery is a Collection - this is not the same data source as the form. 

    This is causing issue like you mention. I am not sure how to resolve this as the form needs to save the data to SharePoint and I am using collection to hold the data on the app until user submits the collection so that they edit data on the from app not from the sharepoint list. 

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 
    The form can read data from a collection using my method.  The collection just needs to have all the same fields as the SharePoint list.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    That is why I use the Lookup() for the Items property rather than Gallery1.Selected.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

     Hi 

     

    I am just trying to use your method I get some errors:

     

    Set(varCurrentRecord, OTRReview_1.LastSubmit) - this says cant evaluate the formula 

    Set(CurrentRecord, ThisItem.ID) - also cant evaluate, context variable types incompatible 

     

    This is how I create my collection maybe its is the wrong way?

    Collect(CollectOutTurnFrom, {
        c_Title:ValueBranch.Selected.Value,
        c_DateTime: Now(),
        c_RefNo:ValueRefNo.Text,
        c_Supplier:ValueSupplier.Selected.Value,
        c_Destination:ValueDestination.Selected.Value,
        c_Commodity:ValueCommodity.Selected.Value,
        c_ECT:ValueECType.Selected.Value,
        c_DCT:ValueDCType.Selected.Value,
        c_ECQty:Value(ValueEntryQTY.Text),
        c_DCQty:Value(ValueDiscQTY.Text),
        c_Reason:ValueReason.Selected.Value,
        c_Note:ValueNote.Text});

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Drrickryp
    Your method is probably best suited here.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    LookUp(OutTurn_Choices, ID = OTRReview_1.Selected.ID)

     

    Its returning "Name is invalid. The identifier isn't recognized. "

     

    Should I be setting a ID variable in my gallery?

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Drrickryp  Thanks

     

    Also just to update anyone with similar problem.
    I change my approach to the problem. I will allow user to submit the form directly to sharepoint, use that data source in my gallery to allow people to edit it. The formula above work for identifying the record in the gallery to FormMode.Edit

     

    I will try to filter the gallery to only show recently added record. Hope this will all work out 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard