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 / Drop Columns not working?
Power Apps
Answered

Drop Columns not working?

(1) ShareShare
ReportReport
Posted on by 97

What is wrong with this formula? The error I'm getting is on the rename columns step stating that "a column named field_6 already exists". But I'm literally dropping the field_6 column in the previous step. Does drop columns simply not work? This should be taking the email addresses in field_6, making them insensitive by running them through the Lower function and saving them to a new field, then drop the original field_6 and rename the new field to field_6. When I view the collects created at these various steps, those columns do not appear in the collections. This code worked fine six months ago.

 

ClearCollect(formattedcolSecurityAll,
                    RenameColumns(
                        DropColumns(
                            AddColumns(
                                colSecurityAll
                            ,insensitivefield_6,Lower(field_6))
                        ,field_6)
                    ,insensitivefield_6,field_6));
Categories:
I have the same question (0)
  • rzuber Profile Picture
    552 Moderator on at

    @dsagfhjj try

     

    With(
     {_records: DropColumns(AddColumns(colSecurityAll, insensitivefield_6, Lower(field_6)), field_6)},
     ClearCollect(formattedcolSecurityAll, RenameColumns(_records, insensitivefield_6, field_6)
    );

     

    To answer your question, I believe the issue here is that Power Apps is declarative.. Meaning it's trying to remove and add the column at the same time, and it doesn't understand how to do that..

     

    To fix it, you define the table inside the context record of the With() statement, and then collect the defined table with the renamed column into the collection.

     

  • MV-30041934-0 Profile Picture
    97 on at

    This gives the same error.

  • rzuber Profile Picture
    552 Moderator on at

    @dsagfhjj  Strange... I will do some testing and report back.

  • rzuber Profile Picture
    552 Moderator on at

    @dsagfhjj What if you change it to:

    With(
     {
     _records: RenameColumns(
     DropColumns(AddColumns(colSecurityAll, insensitivefield_6, Lower(field_6)), field_6), 
     insensitivefield_6,
     field_6
     )
     },
     ClearCollect(formattedcolSecurityAll, _records)
    );
  • rzuber Profile Picture
    552 Moderator on at

    @dsagfhjj I have tried both of my suggestions on a temporary table, and received no errors.. There is another element to this puzzle we are missing.

  • MV-30041934-0 Profile Picture
    97 on at

    Same error.

  • MV-30041934-0 Profile Picture
    97 on at

    Maybe I have the collection being used somewhere else? I'll have to look around.

  • rzuber Profile Picture
    552 Moderator on at

    @dsagfhjj Can you show me a screenshot showing where all the squiggly lines are in your formula?

  • Verified answer
    rzuber Profile Picture
    552 Moderator on at

    @dsagfhjj What if you change it to

     

    ClearCollect(
     formattedcolSecurityAll,
     ForAll(
     colSecurityAll As _record,
     Patch(_record, {field_6: Lower(_record.field_6)})
     )
    );

     

  • MV-30041934-0 Profile Picture
    97 on at

    dsagfhjj_0-1720448176057.png

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard