318
Views
7
Comments
Solved
How to auto-calculate the total price from two diferent aggregates in a web screen

Hi,


I'm trying to "auto" calculate the total of a order. 

Example:

Barbecue Pizza = 10€

Coca-Cola = 5€


What I have to do so this auto-calculate the Total of the order?


Ps: I have 2 diferent aggregates for Pizzas and Drinks, in which, both of them has diferent prices for the diferent "objects".


Thanks.

2024-11-20 08-28-20
Pedro Marques
Solution

Hi Guilherme,

On your aggregate, you can click on the arrow on the top right corner of your attribute and get the sum off all the records for that attribute.


If you have two aggregates, you would have to do this for both and then sum those values, like this:


Let me know if this helps,

Pedro

2024-11-20 08-28-20
Pedro Marques

You can also create new attributes where you can add your own logic. In this case, I'm calculating the Price * Quantity to get the Total Price of an order.


Let me know if this helps.

2021-01-19 14-07-32
Tom Zhao

Hi,

You can't auto-calculate the value across different aggerate. You have to do that manually by adding some code.

Can you consider combining two aggregates into one? I think it's not difficult.

Kind Regards


2020-09-01 10-42-42
Stefano Valente

I think you are right. If its the same order, why not use 1 aggregate and if you want to display them in separate tables, then use the listfilter.

As for the sum, i think this is easy: if the aggregate gives few records then just loop throught them to get the total. If there are many records, perhaps its best tu create another aggregate with a group by and use the sum.


UserImage.jpg
Guilherme Aleixo

@Pedro Marques  Thank you! Worked just fine!

2024-11-20 08-28-20
Pedro Marques

Glad it worked!

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