How to add an additional variable attribute to an aggregate?

Hello,

Is there a way to add a new attribute to an aggregate that is not a calculated attribute?

I would like use some variables to control the screen presentation of each aggregate row and they do not need to be persisted in the database. 

Thank you,

Rui

Solution

Hi Rui,

An Aggregate's calculated attributes are not persisted in the database, they are however calculated by the database engine, and there is no way to add extra attributes to an Aggregate's output.

If you decide not to use database calculated attributes, you will have to resort to have your own variable of type List of Record that includes all sources from the Aggregate plus the extra attributes you need, and you will also need to copy the output of the Aggregate to this variable and assign values to those extra attributes... In most situations this copying around data will impact performance though.

Hope this helps!

Solution

Hello Jorge,

Thank you for your answer. 

I believe it will solve it but, as you said, it is will impact perfomance. Since I only need a boolean, I will just extend the entity in the database. The performance impact will be lower.

Best regards,

Rui  

Hi Rui,

Just to be crystal clear... and since there's a missing word in my answer:  

An Aggregate's calculated attributes are not persisted in the database, they are however calculated by the database engine, and there is no other way to add extra attributes to an Aggregate's output.

I'm suggesting you add a calculated attribute in your Aggregate, not that you add another attribute to your Entity.

When you add a calculated attribute in the Aggregate, you're not extending the entity in any way, you're just telling the database to add an extra output column to its results (with whatever value calculated when the query is performed, for instance  the True value).

Sorry for omitting essential words before...