cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,801)