cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Pass variable into DropColumns or workaround

Hello everybody !

 

I want to delete columns from my collection, but I don't want to delete the same columns every time.

I would like to select the columns to delete using a drop-down list or in another way but DropColumn does not accept a variable.

 

Do you know a way to do it?

 

Thank for your help, and have a good day!!

3 REPLIES 3
Highlighted
Super User III
Super User III

@ju84000000 

For example, let’s say your Collection has three Columns named: ColA, ColB, ColC.

 

Put this code in the Items property of a dropdown to populate it with options for removal

 

[“ColA”, “ColB”,”ColC”]

Then create a button and put this code inside the  OnSelect property:

 

DropColumns(your_collection_name, Dropdown1.Selected.Value)

 

Now when you press a button it will delete the column with the name selected in the dropdown

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted

Thanks for the help but it doesn't works.

 

DropColumns wants " literal text ", even with DropColumns( MyCollection ;  Text(Dropdown.Selected.Value) ) it does'nt works.

Highlighted

@ju84000000 
Good heavens, you're totally right!  My method worked on SORTBYCOLUMNS so I just assumed DROPCOLUMNS would work dynamically as well!

 

Put this code in the Items property of a dropdown to populate it with options for removal

["ColA","ColB","ColC"]



Then create a button and put this code inside the  OnSelect property:

ClearCollect(
    colNewCollection,
    Switch(
        Dropdown1.Selected.Value,
        "ColA", DropColumns(your_collection_name, "ColA"),
        "ColB", DropColumns(your_collection_name, "ColB"),
        "ColC", DropColumns(your_collection_name, "ColC")
    )
)
            

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,741)