How can i get the total price?
Question

I have a list product. you can choose a product and then you can choose how much you want of the selected product.

Suppose I want to order two different products, I want to display the total amount of both below.

mvp_badge
MVP
Solution

Hi KA,

For the mentioned use case, I would suggest to make the temp calculation in the client side and save the final selection on the Complete Order button click. Refer to the below metioned approach to implement the client side calculation logic.

Implementation Steps:

1) Add an additional TotalPrice (will hold Quantity * ProductPrice value) attribute in the structure.

2) On Adding Product, the assignment node should look like the below

3)On Removing Product / Decreasing the Product quantity, the assignment node should look like the below

3) Total Product Price Expression (Table 5th Column)

4) Grand Total Expression (GrandTotal - Local Decimal Type variable)

Refer to the attached oml file

I hope this helps you!


Kind regards,

Benjith Sam

Brood.oml

Try COUNT() and SUM() in the aggregate and dont forget to refresh the values when they change. 

I use structure for total

And the action to do the calculation, could you share it?

You do have an action for the buttons, right? When you click they increase or decrease. In that action you must refresh these values and have an assign with this formula (Aantal * Product.Price_Sale). 

if you can't implement this solution, i would ask you for the OML (if possible and you don't mind) so i can check the code here

I have two actions one for plus and one for min. and in the action i used only the assign. 

This is action for plus+

Try to put the formula in the same assign of that action, so whenever you click it will recalculate the total value.

Share the OML File here and I will send it back with the changes I mentioned before.

A few things about it: i just made the math (in the screen "NewOrderCheck!). It does not insert new records in the database. 

In that screen you should be using the Order table, not Product. In the Order table you should have the ProductId and the quantity, so we can calculate the total for each product. Instead using the Product table, you should have a variable with datatype 'Order List', since you may have multiple products in the same order.  (I ended up adding these fields in the Product table just to make the calculation work on the screen, but I know it wasn't the ideal place)

There you can have an aggregate to join both tables, and from the FK_Ids in the Order List Variable you can access their values.

I'm not home yet, so I couldn't delve deeper into the solution, but that's what I realized. As I understand the idea of the application, it will be necessary to remodel part of its database. 

Later I can create a simple CRUD with these two tables (Product and Order) as an example.

BroodCheck.oml

mvp_badge
MVP
Solution

Hi KA,

For the mentioned use case, I would suggest to make the temp calculation in the client side and save the final selection on the Complete Order button click. Refer to the below metioned approach to implement the client side calculation logic.

Implementation Steps:

1) Add an additional TotalPrice (will hold Quantity * ProductPrice value) attribute in the structure.

2) On Adding Product, the assignment node should look like the below

3)On Removing Product / Decreasing the Product quantity, the assignment node should look like the below

3) Total Product Price Expression (Table 5th Column)

4) Grand Total Expression (GrandTotal - Local Decimal Type variable)

Refer to the attached oml file

I hope this helps you!


Kind regards,

Benjith Sam

Brood.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.