13
Views
4
Comments
Solved
Calculated attributes (guided paths) created via expressions

Hey everyone!

I would appreciate it if someone could check to see if anything is missing or if it is actually included in the explanation. I am sorry for the question, just wanted to check it.


According to the guided paths "Calculated attributes are custom values that we can compute from other attributes in the output of the aggregate (...) can be created via expressions, which have access to all attributes in the aggregate as well as Outsystems built-in functions and variables accessible by the aggregate." 

When I add an attribute and calculate something based on my current scope (aggregate) and another aggregate's output (using only on demand, on after fetch, etc.), isn't this also a calculated attribute? Or when it refers to "variables accessible by the aggregate," does it imply not only input, for example, but also access to other aggregates' output?


For instance, when calculating an occupancy rate, I would begin with an initial aggregate that provides a total count, and then use another on demand aggregate that incorporates its own attributes (such as "group by" and "count") along with the total count from the initial aggregate. 

Therefore, I am not only utilising the initial aggregate, but also another one within the context of the screen I am working on. Shouldn't this also be referenced? When I read it and saw the video, I ended up with the feeling it doesn't count/refer to other aggregates (used like stated before).


Thank you! 


Solution

When they refer to "calculated attributes", they mean that INSIDE your aggregate (an in the real world inside the SQL being executed on the database) you can calculate attributes (so pieces of information that will come out of the aggregate by executing it, in the same way the attributes in the entities queried come out)

You can use the values of other attributes in the same resultrow in your formula, and you can use a (limited set of) Outsystems built-in functions in these formulas (in the real world, those functions that are available in the dbms).

As a simple example, let's say you have someone's birth date in the database, you could add a calculated attribute IN THE AGGREGATE that has as value the age of that person.  Or If you have a net price and a vat rate, you could add a calculated attribute with the full price.

So yes, you might make use of output of other aggregates in your formula, but that is no different than any other variable from the perspective of the formula.

Dorine

Hey! 

I was just wondering about the way it's written (transcript) in the guided paths because yes indeed for me it was a calculated attribute. The way it was written made me think that maybe there was something missing there in the text/audio. 

It was mostly about name usage and confirmation on the guided path written information I quoted.. Seemed a little short and not including this case that is also a calculated attribute 

The rest it's OK and also had my example as reference :) 


Maybe it's just my impression, the way it's written or my interpretation. Either way the idea is there and correct... Just details :) 

Thanks for the confirmation Dorine :) 

As soon as an aggregate is executed, the only thing that remains is the output.  And for all next aggregates, that just falls under "variables accessible by the aggregate" 

I wasn't sure if it fell under the category of "variables."

Thank you once again.

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