cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sajarac
Super User
Super User

Create a collection based on Data Table

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,

 

5 REPLIES 5
sajarac
Super User
Super User

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? 

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. 

@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,

 

 

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

 

 

 

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,

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

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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