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 / Can I not drop and add...
Power Apps
Answered

Can I not drop and add column with the same name?

(0) ShareShare
ReportReport
Posted on by 3,347

Why is this broken?

 

 

ClearCollect(NextDataItems,RenameColumns(FirstN(Filter(temporary_assign_wo,Updated<>2 And !IsBlank(_SNValve) ),Value(TextInput6.Text)),"SN_List","SN_List_Del"));
AddColumns(NextDataItems,"SN_List","d")

 

 

martinav_0-1633533134791.png

This works fine if I give the new column a different name.

I initially used DropColumns() but it resulted in the same issue.  Renaming it out of the way doesnt work either.

Categories:
I have the same question (0)
  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @martinav 

     

    ClearCollect(NextDataItems,
     AddColumns(
     DropColumns(
     AddColumns(
     FirstN(
     Filter( temporary_assign_wo, Updated<>2 && !IsBlank(_SNValve) ),
     Value(TextInput6.Text)
     ),
     "SN_List_Del", SN_List
     ),
     "SN_List"
     ),
     "SN_List", "d"
     )
    );
    

     

     

  • martinav Profile Picture
    3,347 on at

    @Alex_10 ,

     

    Yep, thats what I did the first time.  Same result.  It is intuitively correct, but no workie.

     

    martinav_0-1633543677805.png

    Its all happy if I change the name...  same issue.  It MUST be the same name, so I can do a patch back to a SQL list with identical column names.

     

    martinav_1-1633543756799.png

     

     

  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @martinav 

    i suspect DropColums does not really deletes the column if datasource is SP, just hides it.

     

    the only solution i have here is taking a full control over the result collection:

     

    Clear(NextDataItems);
    ForAll(
     FirstN(
     Filter( temporary_assign_wo, Updated<>2 && !IsBlank(_SNValve) ),
     Value(TextInput6.Text)
     ) As ThisSN,
    
     Collect(NextDataItems,
     {
     Title: ThisSN.Title,
     SN_List_Del: ThisSN.SN_List,
     SN_List: "d"
     }
     )
    )

     

  • martinav Profile Picture
    3,347 on at

    @Alex_10 ,

     

    Yea, I was hoping to avoid that.  There are like 25 columns.  Thats a LOTTA stuff.  

     

    Well, anyway.

     

    Thanks

  • WarrenBelz Profile Picture
    155,320 Most Valuable Professional on at

    Hi @martinav ,

    This should work

    With(
     {
     wList:
     DropColumns(
     temporary_assign_wo,
     "SN_List"
     )
     },
     ClearCollect(
     NextDataItems,
     AddColumns(
     FirstN(
     Filter(
     wList, 
     Updated <> 2 And !IsBlank(_SNValve)
     ),
     Value(TextInput6.Text)
     ),
     "SN_List",
     "d"
     )
     )
    )

    Note you have a Delegation limitation with Add/Drop columns but you already had that with both of your filter criteria and FirstN

     

    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.

     

  • martinav Profile Picture
    3,347 on at

    @WarrenBelz ,

     

    Another great idea.  However, same result.  It still thinks its there.  I moved the filter around to make this a bit more simple where its broken.

     

     

    With(
     {
     wList:
     DropColumns(
     FirstN(
     Filter(
     temporary_assign_wo, 
     Updated <> 2 And !IsBlank(_SNValve)
     ),
     Value(TextInput6.Text)
     ),
     "SN_List"
     )
     },
     ClearCollect(
     NextDataItems,
     AddColumns(wList,"SN_List","d")
     )
    )

     

     

    Result:

    Same

    martinav_0-1633963556460.png

    Regarding delegation:  Its true, but for this purpose, it does not affect the purpose for which I'm using this.

  • WarrenBelz Profile Picture
    155,320 Most Valuable Professional on at

    Hi @martinav ,

    I actually thought that would work, however the long way . . .

    ClearCollect(
     colDrop,
     DropColumns(
     temporary_assign_wo,
     "SN_List"
     )
    );
    ClearCollect(
     NextDataItems,
     AddColumns(
     FirstN(
     Filter(
     colDrop, 
     Updated <> 2 And !IsBlank(_SNValve)
     ),
     Value(TextInput6.Text)
     ),
     "SN_List",
     "d"
     )
    );
    Clear(colDrop)

     

    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.

  • martinav Profile Picture
    3,347 on at

    @WarrenBelz ,

     

    I've been down this avenue as well.  I'm with you about the 'should work' situation.  I suspect this must have something to do with the fact the data comes from an SQL Table?  Well, if nothing makes sense, it something that doesnt make sense that is the explanation.

     

    martinav_0-1633989069352.png

     

  • WarrenBelz Profile Picture
    155,320 Most Valuable Professional on at

    Hi @martinav ,

    Got it to work with ShowColumns (RenameColumns fails too in SharePoint) in the first bit - and you are correct that it should work . . .

     

    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.

  • martinav Profile Picture
    3,347 on at

    @WarrenBelz ,

    I also have an issue with Patch() with SQL tables.  I also cannot patch from a collection into an SQL table if ANY columns in the collection do not exist in the table.  It will give the error "ColumnName Does not Exist".  Even if I'm not patching to that particular column.  It fails.  This has been a real PiTA! I have blown like 4 days on this now.  I am now going to create ANOTHER collection, specifically created those columns that are necessary to generate SN_List.  Then try to Patch() that back into table.  I'm losing my bloody mind on this.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 893

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 482

Last 30 days Overall leaderboard