Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Js1yW1BbQzLFx/SEWRLplS
Power Apps - Building Power Apps
Unanswered

Create a collection based on Data Table

Like (0) ShareShare
ReportReport
Posted on 22 Nov 2019 16:16:35 by 3,263

Hello,

 

Quick question here?

 

How can I collect from a table where my fields are marked as follow:

 

FieldA_Column1, FieldB_Column1, FieldC_Column1, etc.....

 

I am having some hard time with this.

 

 

thanks in advance,

 

 

Regards,

 

Categories:
  • RK800-1 Profile Picture
    32 on 18 Oct 2023 at 18:36:13
    Re: Create a collection based on Data Table

    Hi!

     

    I guess you can just try the following:

    ClearCollect(
     Collection_Name,
     Table_name
    )

    And if you want to insert values from the specific columns, you can try the following:

    ClearCollect(
     Collection_Name,
     ForAll(
     ShowColumns(
     Table_Name,
     "Table_Column_Name1",
     "Table_Column_Name2"
     ),
     {
     Collection_Property1: Table_Column_Name1,
     Collection_Property2: Table_Column_Name2
     }
     )
    );

     

    In this example, Collection_Property values can be named whatever you want.

  • v-xida-msft Profile Picture
    on 25 Nov 2019 at 07:10:30
    Re: Create a collection based on Data Table

    Hi @sajarac ,

    Could you please share more details about the formula you typed within the Items property of the Data Table?

    Do you want to collect the data from the Data Table into a collection?

     

    Based on the formula you provided, I think there is something wrong with it. If you want to collect all records from the Data Table into a collection, I afraid that there is no way to achieve your needs. Currently, there is no way to collect all records from a Data Table in PowerApps, instead, you could only select single one record once time from the Data Table.

     

    As an alternative solution, if you want to collect all records from the Data Table, please take a try with the following formula:

    ClearCollect(SendtoFlow2, "Type the formula you specified within the Items property of the Data Table here")

    For the second argument of the ClearCollect formula, please type the formula you used for the Items property of the Data Table.

     

    On your side, you should type the following formula within the OnSelect property of the "Submit" button:

    ClearCollect(SendtoFlow2, "Type the formula you specified within the Items property of the Data Table here");
    FlowName.Run(JSON(SendtoFlow2))

    Note: Currently, the flow only accept string parameter passed from an app, you could not pass a JSON Table data from an app to a flow directly. So you need to convert the JSON table value into a JSON String firstly, then pass the converted JSON string into your flow.

    Within your flow, you could use the json() WDL expression to convert the passed JSON String into a JSON table, then you could do some operations on the JSON Table in your flow (e.g. apply a "Apply to each" action to the converted JSON Table).

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Sajarac Profile Picture
    3,263 on 23 Nov 2019 at 17:33:50
    Re: Create a collection based on Data Table

    OK, here is what I have, the data in my table is from a gallery. 

    Table = DataTable1

    Fields:

    Building Name

    Description

    UoM

    Price

    Quantity

    ItemID    etc

     

    I have tried this one:

    ClearCollect(SendtoFlow2, DataTable1);LabelCustomer,UoM,Price,Quantity,ProjectAmount,BidItem,ItemID,BuildingID,CustomerName,ST,Quote,Contract,DescriptionCost)

     

    This

    ClearCollect(SendtoFlow2, DataTable1,LabelCustomer,UoM,Price,Quantity,ProjectAmount,BidItem,ItemID,BuildingID,CustomerName,ST,Quote,Contract,DescriptionCost)

     

    And this:

    ClearCollect(SendtoFlow2, DataTable1)

     

    And all of them gives me error, any idea?

     

    thanks

     

    Capture.PNG

     

     

     

  • Sajarac Profile Picture
    3,263 on 23 Nov 2019 at 16:55:18
    Re: Create a collection based on Data Table

    @TiagoFreire , Thank you very much for your response.

     

    Sorry just clarify, you mean:

    That I need a button to create the collection with this

     

    ClearCollect(stufftosendtoflow, datasource);FlowName.Run(stufftosendtoflow)

     

    Then another button with this:

     

    Set(json_data, JSON(ClearCollect(stufftosendtoflow, datasource)));FlowName.Run(json_data)

     

    Thanks in advance,

     

     

  • TiagoFreire Profile Picture
    313 on 22 Nov 2019 at 20:40:44
    Re: Create a collection based on Data Table

    You have to do stuff one at a time. Collect first, then send it.

     

    ClearCollect(stufftosendtoflow, datasource);
    FlowName.Run(stufftosendtoflow)

     

    Personally, I have better time using JSON to  send stuff to Power Automate (formerly Flow), and use Parse JSON there to manipulate it. 

     

    Set(json_data, JSON(ClearCollect(stufftosendtoflow, datasource)));

    FlowName.Run(json_data)

     

    On Flow, Parse JSON turns it back into an object. 

     

    It also gives me the freedom of asking for a single Params parameter, that I can change the payload as my app evolves, without having to re-add the Flow to my PowerApp every time I add or remove separate parameters. 

  • Sajarac Profile Picture
    3,263 on 22 Nov 2019 at 17:04:31
    Re: Create a collection based on Data Table

    I am trying to create a collection to send that collection to m y flow, so I am using this formula for the onselect action:

     

    ClearCollect(SendtoFlow2(DataTable1Title,UoM,Price,Quantity,Amount,temID,CustomerName,ST,DescriptionCost))

     

    And the result is:

     

    Invocation of unknown or unsupported function.

     

    Any idea? 

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!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,786 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard