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 / Error after reusing my...
Power Apps
Answered

Error after reusing my code

(0) ShareShare
ReportReport
Posted on by 60

 

 

Hello,

 

I had this code on another screen, but when I am trying to apply it to the new one (which has the same components but the Gallery name Excel) is showing me this:

 

Emont_0-1639326209820.png

And the second would be, I am having multiple data in the Gallery Excel:

Emont_1-1639326330770.png

How can use the code above to save the data in the SharePoint list without affecting the other record (like a SQL Update using the where clause)?

 

Thanks in advance for the help.

 

 

Categories:
  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @Emont ,

    What is the error that is showing here and what are the Items of the Excel Gallery?

  • Emont Profile Picture
    60 on at

    @WarrenBelz This is the message I receive:

     

    Emont_0-1639350452222.png

    Thank you.

  • Emont Profile Picture
    60 on at

    Emont_1-1639350906067.png

    Emont_2-1639350981072.png

     

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @Emont ,

    Is Excel the actual name of the Gallery and do the four fields exist in collCatDescServ2 (I assume this is a collection). How do you collect this as the error refers to the Author field, which is actually Created by in the list.

  • Emont Profile Picture
    60 on at

    I was able to change the code but now is not working with the filter:

    ForAll(
     CollCatDescServ,
     Patch(
     CATEGORIASERVICIOSDATAGATHERING,
     First(Filter(CATEGORIASERVICIOSDATAGATHERING, Excel.Selected.FOLIO, Excel.Selected.SERVICEDESCRIPTION, Excel.Selected.TYPEOFSERVICE)),
     {
     //Title: COLLTYPEOFSERVICE,
     TYPEOFSERVICE: Excel.Selected.TYPEOFSERVICE,
     SERVICEDESCRIPTION: Excel.Selected.SERVICEDESCRIPTION,
     QUANTITYTYPEOFSERVICE: Excel.Selected.QUANTITYTYPEOFSERVICE,
     UNITOFMEASURESERVICEDESCRIPTION: Excel.Selected.UNITOFMEASURESERVICEDESCRIPTION,
     CAPACITYSERVICEDESCRIPTION: Excel.Selected.CAPACITYSERVICEDESCRIPTION,
     HSECOMMENTS: Excel.Selected.HSECOMMENTS
     //NUMBER: COLLNUMBER,
     //UOMSERVICEDESCRIPTION: ,
     //FOLIO: "WellLogistic-" & varLastRequest1.ID
     }
     )
     );
     Notify("El registro fue actualizado",NotificationType.Success);
    /*Patch(

    Error:

     

    Emont_0-1639425591454.png

     

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @Emont ,

    You did not really answer the questions I asked

    • How do you collect colCatDescServ (code in Text please)
    • What is the reference to the Authors field
    • What are the Items of the Excel gallery

    Also that is not a valid Lookup - the parameters have to equal something.

    First(
     Filter(
     CATEGORIASERVICIOSDATAGATHERING, 
     Excel.Selected.FOLIO, 
     Excel.Selected.SERVICEDESCRIPTION, 
     Excel.Selected.TYPEOFSERVICE
     )
    ),

     

  • Emont Profile Picture
    60 on at

    Hello @WarrenBelz I hope you have a great 2022!

     

    Sorry I was not able to connect because I was on vacations.

     

    So here are the answers to the issue reported:

     

    • How do you collect colCatDescServ (code in Text please)

     

    UpdateContext({vGallery1_4:false});
    UpdateContext({RequestTOFF4:false});
    UpdateContext({vLabel17:false});
    UpdateContext({vRectangle5:false});
    Collect(
     CollCatDescServ2,
     {
     COLLTYPEOFSERVICE: Excel.Selected.TYPEOFSERVICE,
     COLLSERVICEDESCRIPTION: Excel.Selected.SERVICEDESCRIPTION,
     COLLQUANTITYTYPEOFSERVICE: Excel.Selected.QUANTITYTYPEOFSERVICE,
     COLLUNITOFMEASURESERVICEDESCRIPTION: Excel.Selected.UNITOFMEASURESERVICEDESCRIPTION,
     COLLCAPACITYSERVICEDESCRIPTION: Excel.Selected.CAPACITYSERVICEDESCRIPTION,
     COLLHSECOMMENTS: Excel.Selected.HSECOMMENTS
     //COLLNUMBER: Excel.Selected.Number
     }
    );

     

    The code is triggered when the Pencil or edit Button is pressed:

    Emont_0-1642352699542.png

     

     Then I pressed the Edit button to make all fields available and after that I press the Save Info Button and this is the code:

     

    ForAll(
     CollCatDescServ2,
     Patch(
     CATEGORIASERVICIOSDATAGATHERING,
     First(Filter(CATEGORIASERVICIOSDATAGATHERING, Excel.Selected.FOLIO, Excel.Selected.SERVICEDESCRIPTION, Excel.Selected.TYPEOFSERVICE)),
     {
     //Title: COLLTYPEOFSERVICE,
     TYPEOFSERVICE: Excel.Selected.TYPEOFSERVICE,
     SERVICEDESCRIPTION: Excel.Selected.SERVICEDESCRIPTION,
     QUANTITYTYPEOFSERVICE: Excel.Selected.QUANTITYTYPEOFSERVICE,
     UNITOFMEASURESERVICEDESCRIPTION: Excel.Selected.UNITOFMEASURESERVICEDESCRIPTION,
     CAPACITYSERVICEDESCRIPTION: Excel.Selected.CAPACITYSERVICEDESCRIPTION,
     HSECOMMENTS: Excel.Selected.HSECOMMENTS
     //NUMBER: COLLNUMBER,
     //UOMSERVICEDESCRIPTION: ,
     //FOLIO: "WellLogistic-" & varLastRequest1.ID
     }
     )
     );
     Notify("El registro fue actualizado",NotificationType.Success);

     

    • What is the reference to the Authors field

    This Authors field cannot find it sorry, where did you see it?

     

     

    • What are the Items of the Excel gallery

    That's Excel Gallery with its items

    Emont_1-1642352917943.png

     

    Thank you so much for your help, I am really thankful.

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @Emont ,

    Firstly the Author field is the error you posted

    WarrenBelz_0-1642373166111.png

    Next, your filter criteria is not specifying the record you want to patch (what is the key unique field in CollCatDescServ2 that matches the record in CATEGORIASERVICIOSDATAGATHERING ? 

    Your Patch would be something like this

    ForAll(
     CollCatDescServ2,
     Patch(
     CATEGORIASERVICIOSDATAGATHERING As aPatch,
     {IDField:aPatch.IDField},
     {
     TYPEOFSERVICE: aPatch.TYPEOFSERVICE,
     SERVICEDESCRIPTION: aPatch.SERVICEDESCRIPTION,
     QUANTITYTYPEOFSERVICE: aPatch.QUANTITYTYPEOFSERVICE,
     UNITOFMEASURESERVICEDESCRIPTION: aPatch.UNITOFMEASURESERVICEDESCRIPTION,
     CAPACITYSERVICEDESCRIPTION: aPatch.CAPACITYSERVICEDESCRIPTION,
     HSECOMMENTS: aPatch.HSECOMMENTS
     }
     )
    );
    Notify("El registro fue actualizado",NotificationType.Success);

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

     

  • Emont Profile Picture
    60 on at

    Thank you @WarrenBelz I was checking and I was able to find the issue and it was related with the Collection name and I change it but now is showing an error:

     

    Emont_0-1642980877528.png

    Emont_1-1642980946295.png

    And the reason I choose these three values is because there are several records with the same folio number, so I try to narrow down to just one record.

     

    How to fix this issue? 

     

    Thanks in advance for the assistance.

     

     

     

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @Emont ,

    As I posted, that is not a valid filter. You have simply listed three fields - they have to be compared with something. What do they have to equal to find the record you want?

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 339 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard