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

Create new collection from existing collection - but with fewer columns

Hi All

I would like to create  a new collection from the below collection with only columns found in colDisplayColumns collection

Below collection holds data with n number of columns

ClearCollect(coltableData,MYData);

 

Below collection holds columnsNames to be displayed
ClearCollect(colDisplayColumns,DisplayColumnsTable);

 

Required New collection of coltableData with  columnsNames only specified in colDisplayColumns collection

 

e.g If coltableData has 10 columns and colDisplayCOlumns holds values of only those columns that have to be shown .SO i want to create a new collection coltableData with only those 5 columns .

Example 

coltableData :    Location              Date          Value    Amount

                      New York       12/19/2020        5             10

                      New York       12/23/2020        3             20

                      New York       12/25/2020        2             30

 

colDisplayCOlumns :    ColumNames   InternalColumnName

                                     Value                  cr12_Value               

                                    Amount             cr12_Amount             

                                      Date                cr12_Date            

 

Desired Collection:

                                                   Date          Value    Amount

                                             12/19/2020        5             10

                                             12/23/2020        3             20

                                            12/25/2020        2             30

                         

 

I have tried dropcolumns function but it accepts only hardcoded string values not dynamic values.

 

Can any one please help me on this one

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @Hetvik ,

 

Unfortunately this is difficult to achieve.

You cannot use a string to refer to a column name (not allowed in powerapps).

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

1 REPLY 1
v-xiaochen-msft
Community Support
Community Support

Hi @Hetvik ,

 

Unfortunately this is difficult to achieve.

You cannot use a string to refer to a column name (not allowed in powerapps).

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,162)