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

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

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

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. 

Highlighted
Super User
Super User

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

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

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

Highlighted
Super User
Super User

Re: How to multiple values in a collection?

You beat me to it!

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,574)