cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
oliverbusk
Level: Powered On

Add multiple items to collection (same row)

Hi

I am using the new AI Builder with PowerApps. In my model, I have a table field that contains "QTY" and "NET PRICE". So on the AI Builder element within the PowerApps editor, I add these to a collection called "TableCollection":

 

Collect(TableCollection;FormProcessor1.FormContent.Tables.table_0.QTY;FormProcessor1.FormContent.Tables.table_0.'NET PRICE')


I have then added a simple datatable, to show these values:

Items: TableCollection


However this add each table.item to their own row as below. I would like these to be on the same row:

table.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
oliverbusk
Level: Powered On

Re: Add multiple items to collection (same row)

OK I found a solution. It seeems, that instead of adding the table items from the AI Form Processor to a collection, I can simply add them directly to a table.

So for my table object, I add this to the "Items" field:

 

FormProcessor1.FormContent.Tables.table_0

View solution in original post

7 REPLIES 7
SimonPiquer
Level 8

Re: Add multiple items to collection (same row)

Hi,

 

I am not able to try this using the AI builder currently, but here are my thoughts:

 

When you deliminate in the Collect function you create a new Item.


Instead try the following: 

Collect(TableCollection;{QTY: FormProcessor1.FormContent.Tables.table_0;'NET PRICE':FormProcessor1.FormContent.Tables.table_0)

 
Would that work?

oliverbusk
Level: Powered On

Re: Add multiple items to collection (same row)

Got a bit closer to a solution I believe. Now the content is on the same row, but it prints [object Object]:

 

table.PNG

Community Support Team
Community Support Team

Re: Add multiple items to collection (same row)

Hi @oliverbusk ,

Do you want to add the QTY field value and "NET PRICE" field value into a same row of a Collection?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the " Button" control to following:

 

Collect(
TableCollection;
{
QTY: FormProcessor1.FormContent.Tables.table_0.QTY ;
'NET PRICE': FormProcessor1.FormContent.Tables.table_0.'NET PRICE'
}
)

Or

ClearCollect(
        TableCollection;
        {
          QTY: FormProcessor1.FormContent.Tables.table_0.QTY ; 
         'NET PRICE': FormProcessor1.FormContent.Tables.table_0.'NET PRICE'
        }
)

 

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.
oliverbusk
Level: Powered On

Re: Add multiple items to collection (same row)

Hi


Thanks for taking your time to reply. However, it still does not work - still showign [object Object].

 

Capture.PNG

For my DataTable.Items: TableCollection

 

 

Community Support Team
Community Support Team

Re: Add multiple items to collection (same row)

Hi @oliverbusk ,

Could you please share a bit more about the data structure of your table_0? Are there many records within it?

 

Please consider modify your formula as below:

Collect(
TableCollection;
{
QTY: First(FormProcessor1.FormContent.Tables.table_0).QTY ;
'NET PRICE': First(FormProcessor1.FormContent.Tables.table_0).'NET PRICE'
}
)

Or

ClearCollect(
        TableCollection;
        {
          QTY: First(FormProcessor1.FormContent.Tables.table_0).QTY ; 
         'NET PRICE': First(FormProcessor1.FormContent.Tables.table_0).'NET PRICE'
        }
)

 

Please 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.
Highlighted
oliverbusk
Level: Powered On

Re: Add multiple items to collection (same row)

OK I found a solution. It seeems, that instead of adding the table items from the AI Form Processor to a collection, I can simply add them directly to a table.

So for my table object, I add this to the "Items" field:

 

FormProcessor1.FormContent.Tables.table_0

View solution in original post

Community Support Team
Community Support Team

Re: Add multiple items to collection (same row)

HI @oliverbusk ,

Yeah, you are right.

 

If the result the FormProcessor1.FormContent.Tables.table_0 formula returned is a Table value, you could directly type it within the Items property of that control (e.g. Data Table control).

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been 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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 137 members 4,924 guests
Please welcome our newest community members: