cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
oliverbusk
Frequent Visitor

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
Frequent Visitor

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 Resolver II
Resolver II

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
Frequent Visitor

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
Community Support

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
Frequent Visitor

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
Community Support

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
Frequent Visitor

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
Community Support

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,170)