15
Views
4
Comments
Solved
how to sum attributes from the same database?
Application Type
Traditional Web

Hey!

So, I am doing an app to keep on track my tasks and my "to do list" and I want to create something to tell me how much time i spent. I have everything ready, the tasks already have the time I spent. Now, I only need to sum that. How do I sum those attributtes? They are on the same entity... Do I need to create a new entity, the attribute "sum" is in the same entity?

I don´t know,  please help me

If you want me to, i can drop my OML here

Rank: #70
Solution

What do you want to do with that piece of information? To show it on a screen?

If that's the case, you can place an expression on the screen with the SUM field of your query. 


If your screen presents a list of tasks and its time and now you want to show the total, you should separate the queries: one "Get Tasks", the other one "Get Total Time" which sums the time.

Rank: #446

Hi Goncalo,

It would be nice, if you can share the OML here for speedy response.

Thanks & Kind Regards,

Sachin

Rank: #70

Hi Gonçalo,


You can do an aggregate and sum the attribute Time.

On your aggregate, double click the attribute having the time and select the option Sum, like in the example below:


For more information, consider this article from OutSystems documentation:

https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Query_Data/Aggregate_a_Column_into_a_Single_Value


Regards,
João