cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Putting multiple columns into one column

What I was wondering if there a way to take multiple columns and just store them in one column in a collection (and not in a nested record). For example, if I pull Contact1, Contact2, Contact3, Contact4 columns and I want to just store them in a collection with a column that is Contacts, how would I accomplish this.

 

Say Contact1 has values 1, 2, 3

Contact2 has values 5,7

Contact3 has value 9

Contact4 has values 4, 10, 12 

and I would want collection ContactIDs to have a Contacts column that has value 1, 2, 3, 5, 7, 9, 4, 10, 12

 

I have done this several ways but I either get errors in my syntax or a nested column collection which is not what I need.

 

Any help please?

2 REPLIES 2
Community Support
Community Support

Hi @Anonymous,

 

According to my research and test, this seem cannot be achieved so far in PowerApps. Please create a new item in the PowerApps Ideas board, if you feel that this feature is important to you.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

This is an old post but I figured I would answer anyway in case someone else is having this issue. It seems that when you add items to the collection, it will inherit whatever the name of the column you are using. For example:

PrimaryContactSecondaryContact
KevinDavid
AndresMark


When you add "Primary Contact" column to a collection, it will save all the items under that name. When you collect the "Secondary Contact", it will create another column because it sees that the column names are different. If you want to put the contents of each column under one column, you are going to have to rename the columns so that they have the same name. (Just to clarify, we are not changing the actual names of the columns themselves on the database. We are only changing the names on PowerApps so that we can stack both columns together. Don't worry, this will not modify your database)

This is how I would do it:
ClearCollect(tabletest, RenameColumns('ContactsList'.PrimaryContact,"Fieldname1","AllContacts"));
Collect(tabletest, RenameColumns('ContactsList'.SecondaryContact,"Fieldname2","AllContacts"));

Now when you collect the columns, they will stack on top of each other since they now have the same name. You can use whatever name you want but make sure they match so that Collect() function doesn't create a separate column. Also, depending on your data source, your internal field name might be different than your Column name. I use SharePoint so I had to go to the SharePoint list to look up what the internal name of each of my columns were. They may be a weird code like "z4r7" or "OData_x007e_ab4". This may be a helpfull read if you are unfamiliar with this:
https://mstechtalk.com/check-column-internal-name-sharepoint-list/

Hope that helps anyone that is having the same issue.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (38,513)