How Can I Define Custom Columns for Collect Function in Power Apps?

I would like to create a collection from a Sharepoint list in Power Apps. The list contains specific columns which I defined before. But when I add the Collect(mycollection, mySPlist) function as OnStart action I receive a lot of useless column as can be seen in the linked picture. For example "Created date", "ID" even some "table value" like Author.

Of course I cannot process a collection like this because I can't ignore the irrelevant columns when I'm adding a record via some TextInput field. My intention is to update my Sharepoint list with my collection gaining the added records.

The main question: How can I define a collection with custom columns on starting my app?
Thanks for your advices.

2 Answers

Investigate using the ShowColumns(), DropColumns() and AddColumns() Functions.

Example:

  • To remove the useless columns in the Sharepoint list try:
ClearCollect(colTest, 
    ShowColumns(mySPlist,
        "ID",
        "ImportantColumn1",
        "ImportantColumn2"
    )
)

ForAll('source' As item,
   Collect(collection,{
     col1: item.Column,
     col2: item.Column2
     })
  )
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest