cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Wackmack88
Level 8

How to multiple values in a collection?

Hi all,

 

I'm creating an app with repeating tables. All my fields are working except the multiple field. The field is working but the values are not in the collecting so my SharePoint list doenst get the data. First i make an collect from start:

 

 

NewForm(Form1);ClearCollect(ExpenseCollection, {LineItem: "", LineCost: 0, LineCount: 0, LineTotal: 0}) ;Navigate(NewItem, ScreenTransition.Cover)

 

Collecting.png 

When i select the total field en select Default, i choose: LineCount*LineCost, the number multiple but the collection doenst know which field i need to update. How can i combine the formula LineCounst*LineCost and use default LineTotal? The app need to know which field needs to store the date. 

 

Here is my code for every new line, this works all fine:

 

Patch(ExpenseCollection, ThisItem, {LineItem: inputItem.Text, LineCost: Value(inputCost.Text), LineCount: Value(inputAantal.Text), LineTotal: Value(inputTotal.Text)}); Collect(ExpenseCollection, {LineItem: "", LineCost: 0, LineCount: 0, LineTotal: 0})

 

 

I did some extra testing and when i use the save button two times, the total is stored in the collection, doest that make sense? 

Collecting3.pngCollection2.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Wackmack88
Level 8

Re: How to multiple values in a collection?

Yes, found the solution! When i update my collection, i do the multiple here, o men, i really love PowerApps and the community here. 

 

Patch(ExpenseCollection, ThisItem, {LineItem: inputItem.Text, LineCost: Value(inputCost.Text), LineCount: Value(inputCount.Text), LineTotal: Value(inputCount*inputCost.Text)}); Collect(ExpenseCollection, {LineItem: "", LineCost: 0, LineCount: 0, LineTotal: 0})

View solution in original post

6 REPLIES 6
PowerAddict
Level 10

Re: How to multiple values in a collection?

Hi,
What formula are you using to update your collection in which you want the multiplied value to be stored in the total field?
Wackmack88
Level 8

Re: How to multiple values in a collection?

ForAll(ExpenseCollection, If(!IsBlank(LineItem), Patch(ExpenseDetails, Defaults(ExpenseDetails), {Titel: LineItem, ItemCost: LineCost, Count: LineCoun, Total: LineTotal, MasterID: Form1.LastSubmit.ID})));Navigate(Screen1)

I use OnSuccess and all the fields are updated in SP except Total but i found that i need to push the save button twice to collect the multiple values but that doenst work very well for the business. All the others fields are working fine. 

PowerAddict
Level 10

Re: How to multiple values in a collection?

So you are using LineTotal to set the Total value. Where and how is the LineTotal variable getting set?
And yes, I completely understand that clixk9kg it twice isnt an acceptable solution.
Wackmack88
Level 8

Re: How to multiple values in a collection?

The default formula for LineTotal is LineCost*LineCount. I guess i need this to combine with LineTotal so that the information is stored directly?

 

Collecting4.png

 

I also tried to use the OnSelect or OnChange mode to select LineTotal but that doenst work very well. What do you advice for solution?

 

ps: You see LineAantal, that is Dutch for LineCount 🙂

Highlighted
Wackmack88
Level 8

Re: How to multiple values in a collection?

Yes, found the solution! When i update my collection, i do the multiple here, o men, i really love PowerApps and the community here. 

 

Patch(ExpenseCollection, ThisItem, {LineItem: inputItem.Text, LineCost: Value(inputCost.Text), LineCount: Value(inputCount.Text), LineTotal: Value(inputCount*inputCost.Text)}); Collect(ExpenseCollection, {LineItem: "", LineCost: 0, LineCount: 0, LineTotal: 0})

View solution in original post

PowerAddict
Level 10

Re: How to multiple values in a collection?

You beat me to it!

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 (Last 30 Days)
Users online (5,891)