cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
denise_martinca
Helper II
Helper II

Patch - The specified column does not exist

Hi, everyone!

My app has a gallery (galeriaPendientes) where I filter records from a SharePoint list (RetornoFlexible_1) by user. As I need to relate the records with the user, I use another list called "TablaEmpleados". The app relates the column "Legajo" from RetornoFlexible_1 with the USERID from TablaEmpleados, obtains the MANAGER from that record, then looks for the MANAGER in USERID column, obtains the email and finally compares it with the email from the user logged in the app

This is how the app filters those records:

Filter(
       AddColumns(
               AddColumns(
                        RetornoFlexible_1,
                        "ManagerID", LookUp(TablaEmpleados, USERID = Legajo, MANAGER)
               ),
               "ManagerEmail", LookUp(TablaEmpleados, USERID = ManagerID, EMAIL)
       ),
       ManagerEmail = User().Email
)

When the user selects one items, the app shows the details in an other page. The user has to complete some information and save changes which impact in my SharePoint list (RetornoFlexible_1). I use patch function for this however it fails with the following message: " The specified column 'ManagerEmail' does not exist". 

Patch(
     RetornoFlexible_1,
     galeriaPendientes.Selected,
     {JornadaLaboral: Value(dValorJornada.Text)},
     {Mes25: Value(dEtiquetaMes25horas.Text)}
);

 If I change the items property from my gallery to "RetornoFlexible_1" instead of using the filter formula, no errors are shown. I understand that the addcolumn function is causing trouble, however I don't know how to fix it. ¿Could you please help me?

 

Thank you in advanced!

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User II
Super User II

Hi @denise_martinca 

Sure!  Your patch needs to be more specific in identifying the record being patched.

 

 

Patch(
     RetornoFlexible_1,
     Lookup(RetornoFlexible_1, ID = galeriaPendientes.Selected.ID),
     {JornadaLaboral: Value(dValorJornada.Text)},
     {Mes25: Value(dEtiquetaMes25horas.Text)}
);

 

 

When the Items property of the gallery does not match the datasource in a form or Patch(), then a more specific way of identifying the record being patched is needed.  In this case, the ID of the record can be used in the patch.  BTW, this is a very common problem and it can be avoided by always using a lookup to a unique identifier of the record.  I always  use a lookup on forms and in Patches instead of the more generic Gallery.Selected in case the Item property of the gallery is altered in the future or if a collection is used for the gallery instead of a data source. 

View solution in original post

2 REPLIES 2
Drrickryp
Super User II
Super User II

Hi @denise_martinca 

Sure!  Your patch needs to be more specific in identifying the record being patched.

 

 

Patch(
     RetornoFlexible_1,
     Lookup(RetornoFlexible_1, ID = galeriaPendientes.Selected.ID),
     {JornadaLaboral: Value(dValorJornada.Text)},
     {Mes25: Value(dEtiquetaMes25horas.Text)}
);

 

 

When the Items property of the gallery does not match the datasource in a form or Patch(), then a more specific way of identifying the record being patched is needed.  In this case, the ID of the record can be used in the patch.  BTW, this is a very common problem and it can be avoided by always using a lookup to a unique identifier of the record.  I always  use a lookup on forms and in Patches instead of the more generic Gallery.Selected in case the Item property of the gallery is altered in the future or if a collection is used for the gallery instead of a data source. 

View solution in original post

Thank you very much!!! Super useful 😊

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,142)