You're right !!
Here is the final code (Working) !
Method %OnBeforeSave(insert As %Boolean) As %Status [ Private ]
{
set ano=##this.Ano
if '(##this.Versao) {
&sql(SELECT MAX(Versao) into :ver FROM ECOM.EmpresaObjectivo WHERE Ano=:ano)
if (SQLCODE=100) {
set ver=0
}
set ##this.Versao=ver+1
}
if (##this.Activo) {
&sql(UPDATE ECOM.EmpresaObjectivo SET Activo=0 WHERE Ano=:ano)
set ##this.Activo=1
}
Quit 1
}
Denver Braughler wrote:
Nuno Canas wrote:
... As %Status ...
I never tried without QUIT 1 at the end. Of course, with something like quit:SQLCODE<0 0.
