cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

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
Anonymous
Not applicable

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
Highlighted
Super User II
Super User II

Hi,
What formula are you using to update your collection in which you want the multiplied value to be stored in the total field?
Highlighted
Anonymous
Not applicable

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. 

Highlighted

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.
Highlighted
Anonymous
Not applicable

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
Anonymous
Not applicable

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

Highlighted

You beat me to it!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,188)