Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

how to keep few column only from the record source for display form

(0) ShareShare
ReportReport
Posted on by

I am working Teams power app. 

I made a collection on the screen visible. This collection has more than 50 column

on my screen i have a gallery, which is based on the collection above mention.

 

To display related data which is selected in the gallery , I inserted a display form and trying to get few required columns only to display, But it is showing error (shown in the image red underline and error description, surprised that it is showing clearcollect formula also wrong

 

Please check my mistake and advise

On Data source property, I am typing the below code

Clearcollect(CollectForDisplay1,ShowColumns(colAllList,"cr333_recono","cr333_machineid","cr333_model","cr333_serial"))

 

MIA27_0-1708626363081.png

 

  • Verified answer
    Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: how to keep few column only from the record source for display form

    @MIA27 - yes you can chain multiple Collections within the same formula. e.g.:

     

    ClearCollect(
     MyCollection1,
     {
     Column1: "Text 1",
     Column2: "Sample 1",
     Column3: "A"
     },
     {
     Column1: "Text 2",
     Column2: "Sample 2",
     Column3: "B"
     }
    );
    ClearCollect(
     MyCollection2,
     {
     Text1: "Some text",
     Text2: "Some more text",
     Text3: "Even more text"
     }

     

    Note in the above example, MyCollection1 is generated before MyCollection2 is generated. If there is no relationship/dependency between the Collections, it is more optiminal to generate all Collections together using the Concurrent function.

     

    With this function, we do not need to use the semi-colon notation ( ";" ) and instead use the comma notation "," to separate each ClearCollect. (in the English version of Power Apps):

     

    Concurrent(
     ClearCollect(
     MyCollection1,
     {
     Column1: "Text 1",
     Column2: "Sample 1",
     Column3: "A"
     },
     {
     Column1: "Text 2",
     Column2: "Sample 2",
     Column3: "B"
     }
     ),
     ClearCollect(
     MyCollection2,
     {
     Text1: "Some text",
     Text2: "Some more text",
     Text3: "Even more text"
     }
     )
    )

     

    If there is a dependency between Collections - in other words you want to create another Collection which uses data from Collection1, you can use the following pattern:

     

    ClearCollect(
     MyCollection1,
     {
     Column1: "Text 1",
     Column2: "Sample 1",
     Column3: "A"
     },
     {
     Column1: "Text 2",
     Column2: "Sample 2",
     Column3: "B"
     }
    );
    ClearCollect(
     MyCollection2,
     Filter(
     MyCollection1,
     Column3 = "A"
     )
    )

     

  • MIA27 Profile Picture
    on at
    Re: how to keep few column only from the record source for display form

    Dear Imran,

    Thank you so much for your advise.

     

    Just for my learning purpose and for future use, Can I add another collection underneath the same collection formula screen.

     

    I mean, my main collection "colAllList"   is happening on the first screen visible property, as my code is there, 

    Is it possible that under that formula, after putting ; sign I can add another collection based on the above. So that my both collection will be ready upon load of screen and can be used.

     

    Please advise.

     

  • Verified answer
    Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: how to keep few column only from the record source for display form

    @MIA27 apart from "Clearcollect" being the wrong syntax (the correct formula name is "ClearCollect"), the Data Source property is expecting a Table, it is not to be used to initialise a Collection.

     

    Apply your ClearCollect statement onto the OnSelect property of a Button for example, and then in the Data Source property, only enter: CollectForDisplay1

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,026 Most Valuable Professional

Leaderboard