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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (79,244)