cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HansHeintz
Level 8

Patch(TableName not working Patch([@TableName] does work: why?

I have created two new entities

DierLijsten

DierLijstItems

 

I have used patched succesfully in several instances but now suddenly

Patch(DierLijstItems;Defaults(DierLijstItems);{Omschrijving:"test"})


Does not work:

PA says the column Omschrijving does not exist.

If I type my code PA suggests the fields of the table DierLijsten in stead of DierLijstItems


This line does work:
Patch([@DierLijstItems];Defaults(DierLijstItems);{Omschrijving:"test"})

Anyone know why this is so? Do the names of the tables are too much alike? like some old DOS 8 character restriction?

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff lesaltzm
Power Apps Staff

Re: Patch(TableName not working Patch([@TableName] does work: why?

What I suspect is happening here is that this statement is either inside a gallery or form. If that's correct, the issue is that TableName is also the name of a column or relationship on whatever the Items property refers to. In that case, TableName refers to that column (same as ThisItem.TableName), while [@TableName] refers to the data source. This is a well known point of confusion and we're looking into improving it.

View solution in original post

10 REPLIES 10
PavanKumar
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

Hi HansHeintz,

 

Once to to entity and check if the column name Omschrijving exists in the powerplatform. If not then please add if already exists once try to publish your customizations and check.

 

If that doesn't work then instead of display name you can use schemaname as well for that.

 

Please let me know if you have any further questiosn on this.

 

Mark answer as verified if that answered your question.

 

Regards,

Pavan Kumar garlapati

HansHeintz
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

I regret to do not understand your reply.

Check if column exist in the powerplatform.

What is powerplatform?

I have an entity with that field/column.

Otherwise the second example would not work either.

 

PavanKumar
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

Can you please add schemaname instead of display name and check it please?

 

 

Mark answer as verified it it answers your question.

 

Regards, Pavan Kumar Garlapati

HansHeintz
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

"powerapps schemaname"

does not yield any results in google featuring the term "schemaname"

PavanKumar
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

Hi,

 

Apologies for short reply. Let me elaborate here.

 

Navigate to https://make.powerapps.com/environments. open your environment.

 

Expand Data tab left side and you can see Entities. Expand entities as well to see the list of entities.

 

Select your entity and navigate to Fields tab.

 

Verify your field and in that apart from display name the second column name (also called Schema Name). Copy it and use it as follows.

 

Patch([@DierLijstItems];Defaults(DierLijstItems);{schemanamewhichyouhavecopied:"test"})

 

Mark answer as verified if it does answers your question.

 

Regards,

Pavan Kumar Garlapati

 

HansHeintz
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

As stated in my first post I have no problem getting it to work with [@..

I was just wondering why always I simply could use the regular table name and not now.

I just want to know what is going on.

One difference with these tables is that I gave a diffeent name to the table for the plural descrption.

DierLijst and DierLijsten

DierLijstItem and DierLijstItems

To be complete on my FP:

Defaults(DierLijst) also has to be changed to Defaults([@DierLijstItems])
The first did not gave any direct errors but did not work either.

PavanKumar
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

Please check if you have added that in datasource. Click on Insert tab and data sources and check if the entity is selected there. That may be possible reason. If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Regards, Pavan Kumar Garlapati
HansHeintz
Level 8

Re: Patch(TableName not working Patch([@TableName] does work: why?

It works. You are not reading my question.

 

At All

Power Apps Staff lesaltzm
Power Apps Staff

Re: Patch(TableName not working Patch([@TableName] does work: why?

What I suspect is happening here is that this statement is either inside a gallery or form. If that's correct, the issue is that TableName is also the name of a column or relationship on whatever the Items property refers to. In that case, TableName refers to that column (same as ThisItem.TableName), while [@TableName] refers to the data source. This is a well known point of confusion and we're looking into improving it.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,224)