cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sinanaalmac111
Helper I
Helper I

Add Total cost to "Expenses list on powerApps Expenses Report

Hi Everyone 
I created an Expenses App from the template and connected this app to two SharePoint lists "Expense" and "Listitem".

 

I want add Lineitem's Total cost to Expense List By ID 

I couldn't Find  how to do that when I press  Subnit button. 

 

sinanaalmac111_0-1659945803278.png

 Here is my  code 

 

 

SubmitForm(ViewReportEditForm); ApproveExpense.Run(SelectedReport.ID);Navigate('My Expenses',ScreenTransition.None); 

 

 

 

 

 

sinanaalmac111_0-1659947385667.png

 

 

"$" &  If(Sum(Filter(LineItems2,ReportID = Text(SelectedReport2.ID)),Cost)>0,Text(Sum(Filter(LineItems2,ReportID = SelectedReport2.ID),Cost),"[$-en-US]#,###.00"),"0.00")

 

 

 

 

Could you please help me about to solve this issue


Best regards

Sinan

1 ACCEPTED SOLUTION

Accepted Solutions
NandiniBhagya20
Solution Sage
Solution Sage

You can use Patch function to save cost in Expense List - 
Patch(ExpenseListName, LookUp(ID = SelectedReport2.ID), {CostColumnName: ReportDetailsDollarsLabel.Text})
Assuming CostColumnName is single line of text


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

View solution in original post

3 REPLIES 3
NandiniBhagya20
Solution Sage
Solution Sage

You can use Patch function to save cost in Expense List - 
Patch(ExpenseListName, LookUp(ID = SelectedReport2.ID), {CostColumnName: ReportDetailsDollarsLabel.Text})
Assuming CostColumnName is single line of text


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Hi @NandiniBhagya20 
Thank you for your  reply.

Yes ,
CostColumnName is single line of text.

But. the function  is not work. when I type like yours. 

sinanaalmac111_0-1659951498295.png

However, I  wrote like these.  No errors- But this time It didn't work. I tried This lookup function with different many times 

 

 

SubmitForm(ViewReportEditForm); ApproveExpense.Run(SelectedReport.ID);Navigate('My Expenses',ScreenTransition.None); Patch(Expenses,LookUp(Expenses,ID=SelectedReport.ID),{TotalCost:Value(ReportDetailDollarsLabel.Text)});

Or

Patch(Expenses,LookUp(Expenses,ID=SelectedReport.ID),{TotalCost:ReportDetailDollarsLabel});

 

sinanaalmac111_1-1659951620791.png

 

Thank you for  helping me
Reagards
Sinan




@NandiniBhagya20 
This one is solve the problem 

Patch(Expenses,LookUp(Expenses,ID=SelectedReport.ID),{TotalCost:Value(ReportDetailDollarsTake.Text)});


I found the problem. Dollar sign  was prevent  patch function. I  removed it("$")  . And problem solved 

"$" &  If(Sum(Filter(LineItems2,ReportID = Text(SelectedReport2.ID)),Cost)>0,Text(Sum(Filter(LineItems2,ReportID = SelectedReport2.ID),Cost),"[$-en-US]#,###.00"),"0.00")




Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,259)