121
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

2018-10-29 08-31-03
João Marques
 
MVP
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.

2020-09-21 11-35-56
Sachin Waghmare

Hi Goncalo,

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

Thanks & Kind Regards,

Sachin

2018-10-29 08-31-03
João Marques
 
MVP

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

UserImage.jpg
Rio de Imagem Lda

Okay, that solved my problem but how do I show it?

2018-10-29 08-31-03
João Marques
 
MVP
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.

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