Calculation of interdependent virtual attributes

Patrice Nolin Nolin.Patrice at hydro.qc.ca
Wed Apr 7 16:00:34 EDT 2004


Hi,=20
 
I have an object with 2 virtual attributes : hq_A and hq_B=20
 
 
The formula for hq_A is select table TABLE_X and count every row=20
The formula for hq_B is select table TABLE_X and count rows meeting a
condition
 
For performance reason, since for hq_A and hq_B I need to access the =
same
data, I was thinking to put the code for calculation of hq_A and hq_B =
in
HQ_A attribute, setting a private variable hq_C and initiating hq_B =
with the
private variable hq_C (see example below):=20
 
My problem occurs when I use HQ_B before HQ_A because the content of =
the
private variable is calculated when HQ_A is referenced.
 
Is there another way to calculate my variables, without causing =
performance
problems?
Can we trigger the calculation of variables at the instantiation of the
object ?
 
Or what are you suggestion on the matter ?
 
Thanks
 
Pat
 
 
---------------------
 
Example :
 
OBJECT =85
 
begin of private,
hq_C like =85
end of private,
=85.
 
GET_PROPERTY HQ_B CHANGING CONTAINER.
  SWC_SET_ELEMENT CONTAINER 'hq_b' object-private-hq_c.
END_PROPERTY.
 
GET_PROPERTY HQ_A CHANGING CONTAINER.
  SWC_SET_ELEMENT CONTAINER 'hq_a' 2.
object-private-hq_c =3D 1.
END_PROPERTY.
 
 
 
Work well if I refer to HQ_A first. Then HQ_A =3D 2 and HQ_B =3D 1
Don't work well if I refer to HQ_B first. Then HQ_B =3D 0
 
 
------------------------------------------------------------------------=
----
Patrice Nolin, M.Sc.A. (courriel : nolin.patrice at hydro.qc.ca
<mailto:nolin.patrice at hydro.qc.ca> )
Concepteur d=E9veloppement informatique, Projet SIC=20
T=E9l=E9phone : 0-879-6129
 


More information about the SAP-WUG mailing list