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 / A column with the name...
Power Apps
Answered

A column with the name already exists and doesn't exist simultaneously

(1) ShareShare
ReportReport
Posted on by 7

Hi all,

 

I seem to have found Schroedingers Collection.

 

I have to programmatically add a column to a collection in an onSelect Action of a button. The collection then gets patched back to a SQL Server Table. 
When adding the Column with:

 

AddColumns(
 colLocalReasonsSingleShift;
 "EntryID";
 LookUp(
 colSolution As table;
 table.RowNumber = Value(BelongsTo)
 ).ID
 );;

 


There is an Error telling me that EntryID already exists (I would show you a screenshot, but my powerapps is german, thats also why there are semicolons instead of commas).

When I do this however:

 

AddColumns(
 DropColumns(
 colLocalReasonsSingleShift;
 "EntryID");
 "EntryID";
 LookUp(
 colSolution As table;
 table.RowNumber = Value(BelongsTo)
 ).ID
 );;

 

It first tells me that the column doesn't exist and then tells me that the column already exists in the outer addColumn function.
When I use a different column name it works flawlessly with the first variant. Unfortunately, the patch wouldn't work likethat.

I checked the other instances where the collection is created or modified. Before the collection comes into existence the Column "EntryID" from the original datasource is dropped. There is no mending with "EntryID" anywhere else.
I guess this is either a really weird case of caching/ state mix-up or the error message is wrong.

Any ideas on what I can do here?

 

I appreciate any help! 

Regards 
Eric

Categories:
I have the same question (0)
  • Verified answer
    cha_cha Profile Picture
    4,932 Moderator on at

    Hello @HexagonELN 

     

    I had a look at your case and did some tests. I was able to replicate your case and I think you were right with the cache. Once you have a code that adds a new column to a collection, PowerApps already add it in its memory that that column is part of the structure of the collection.

     

    As for your objective with the code, maybe you can revise it and use UpdateIf. I am not familiar with German syntax. I hope you understand.

    //Clears the EntryID
    UpdateIf(colLocalReasonsSingleShift,!IsBlank(EntryID),{EntryID:Blank()});
    
    //Updates the EntryID
    UpdateIf(colLocalReasonsSingleShift,
     Value(BelongsTo) in Distinct(colSolution,RowNumber),
     { 
     EntryID: LookUp(
     colSolution As table, 
     table.RowNumber=Value(BelongsTo)
     ).ID
     }
     )

     

  • HexagonELN Profile Picture
    7 on at

    Hi @cha_cha;
    thank you a lot for the super quick response!

    That worked for me.

    Have a great rest of the week!

  • Anonymous_Hippo Profile Picture
    1,247 Super User 2024 Season 1 on at

    I also happen to stumble across a Schroedingers Collection 😁

    Thanks for reporting this @HexagonELN and thanks @cha_cha for the solution

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard