Property Ano As %Integer [ Required ];

Property ObjectivoAnual As %Float(FORMAT = ".", SCALE = 2) [ Required ];

Property DataRegisto As %Date(FORMAT = 4) [ InitialExpression = {+$H} ];

Property Activo As %Boolean;

Property Versao As %Integer [ Calculated, SqlComputeCode = { Set {*}=##class(ECOM.EmpresaObjectivo).CurrentVersion({Ano})
}, SqlComputed ];


Index ObjectivoAnoIndex On (Ano, Activo) [ Unique ];

Method VersaoGet() As %Integer [ CodeMode = expression ]
{
..CurrentVersion(..Ano)
}

ClassMethod CurrentVersion(ano As %Integer) As %Integer
{
        quit 1
}

Ano is Year
Activo is Active
ObjectivoAnual is YearObjective
DataRegisto is DateRegistered

What I want is to have one or more objectives defined for the same year.
The last one will be Activated deactivating all the others for the same year (my problem is not this)...
Version will be incremented as #of occurences for the same year order by DataRegisto.
So I'll have:
2004, 1000000, 1/11/2003, 1, 1
When I revise the objective I have to enter a new Row, then I'll have
2004, 1000000, 01/11/2003, 0, 1
2004, 1600000, 01/03/2004, 1, 2


Clear !?
Thanks Denver.

Nuno
Denver Braughler wrote:

Nuno Canas wrote:

I have a class that has properties Year and Objective.


Hate to say this for something that sound so simple, but can you post it here?


I want to add a Property "Version" that will be calculated as an
increment for occurences of Year.


Do you mean like SELECT COUNT(Year)+1 into :i%Version FROM myClass WHERE Year < :i%Year ?




Reply via email to