I'm developing application for traditional web.I have database GetMain , where I have many attributes (Date, ProductPrice, SalesAmount, TotalPrice) .My problem is need to calculate total price with previous salesAmount .
For example, if I get SaleAmount ,I want to sum previous total price and only one thing that is automatic calculate in total attribute.
Thanks . Hoping good result.
Hayasaka
Hi Hayasaka,
What you can do is to create a server action with input SalesAmount and Total as the output parameter and also one session variable as SalesAmountTotal with default value 0 and mark the server action as function.
In that server action, add an assignment as Total = SalesAmount + SalesAmountTotal. and SalesAmountTotal = Total
Use this inline function inside your Total column in screen.
NOTE: Don't forget to assign SalesAmountTotal session variable to 0 in preparation as the value persists till session is valid
I'm getting the desired result as below:
Hope this helps! Thanks :)
Hi Shweta Gedam,
Thanks for expalnation.
I'm just trying according to your explanation.But I want to know one thing that is when I do expression ,how can I get CalculateTotalPrice function ?
CalculateTotalPrice is a server action i have created inside Logic Tab-> Server Actions folder which is marked as a function and you can use this function inside expression from UserFunctions folder (Provided Screenshot).
Please refer following screenshot:
I have attached an OML file for reference of implementation.
Thanks and Happy Coding .
Your explanation was really perfect.It does work ! Thanks you so much .
Hayaska
Great!! Welcome Hayasaka , i'm always happy to help.
Thanks and Happy Coding :)
we have new attribute option in aggregate .In the new attribute you can calculate Sales attribute + Total price:
For example
Hope this Helps.
Regards
Samiksha
Hi Samiksha,
I tried according to your explanation.Unfortunately,it didn't work.
Thank for your comment and hoping you can solve my next time issues.
It would be better to give a try with Advance SQL query to add the previous value with the current value. Please see sample query.
Select *, Sum(SalesAmount) Over ( Order by Date ) As CumSum_ByDate From {yourEnitityName}
Thanks & Regards,
Sachin
Hi Sachin ,
Thanks for your suggestion. I achieved with another way.