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

Error after reusing my code

 

 

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Emont ,

I have no idea why your Excel Table is empty, but your ForAll Patch needs to takes this form

ForAll(
   CollCatDescServUpd,
   Patch(
      CATEGORIASERVICIOSDATAGATHERING As aPatch,
      LookUp(
         CATEGORIASERVICIOSDATAGATHERING,
         FOLIO = aPatch.FOLIO &&
         SERVICEDESCRIPTION = aPatch.SERVICEDESCRIPTION &&
         TYPEOFSERVICE = aPatch.TYPEOFSERVICE
      ),
      {
         TYPEOFSERVICE: aPatch.TYPEOFSERVICE,
         SERVICEDESCRIPTION: aPatch.SERVICEDESCRIPTION,
         QUANTITYTYPEOFSERVICE: aPatch.QUANTITYTYPEOFSERVICE,
         UNITOFMEASURESERVICEDESCRIPTION: aPatch.UNITOFMEASURESERVICEDESCRIPTION,
         CAPACITYSERVICEDESCRIPTION: aPatch.CAPACITYSERVICEDESCRIPTION,
         HSECOMMENTS: aPatch.HSECOMMENTS
                    
     }
   )
);

 

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

View solution in original post

12 REPLIES 12
WarrenBelz
Super User
Super User

@Emont ,

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

Emont
Helper I
Helper I

@WarrenBelz This is the message I receive:

 

Emont_0-1639350452222.png

Thank you.

Emont_1-1639350906067.png

Emont_2-1639350981072.png

 

WarrenBelz
Super User
Super User

@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.

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

 

@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
   )
),

 

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.

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
Helper I
Helper I

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.

 

 

 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,491)