Calculation of interdependent virtual attributes
Kjetil Kilhavn
kjetilk at statoil.com
Sat Apr 10 04:18:04 EDT 2004
Sorry, I sent the previous answer before seeing the follow-up messages.=
I think you have a catch 22 situation. You can't have both buffering of=
results and up-to-date results without having some additional informati=
on
available. Depends a little on your data though. If it is not possible =
to
change the values in existing rows it is sufficient to check if the num=
ber
of rows has changed, but otherwise you must check your data every time.=
Unless you have some magic to inform you that the data have been change=
d,
such as a timestamp for the latest table update. But the latter wouldn'=
t be
very reliable unless you have full control on the table updates (e.g. w=
ith
them being performed by an API).
--
Kjetil Kilhavn
=
=
=20
"Weaver, Karen" =
=
=20
<Karen.Weaver at Sonopr To: SAP-WUG at MITVMA.=
MIT.EDU =
=20
ess.com> cc: (bcc: Kjetil Ki=
lhavn) =
=20
Sent by: SAP Subject: Re: RE : C=
alculation of interdependent virtual attributes =
=20
Workflow =
=
=20
<Owner-SAP-WUG at MITVM =
=
=20
A.MIT.EDU> =
=
=20
=
=
=20
=
=
=20
08.04.2004 00:07 =
=
=20
Please respond to =
=
=20
"SAP Workflow Users' =
=
=20
Group" =
=
=20
=
=
=20
=
=
=20
You could invalidate your object by using swc_refresh_object self.
The attributes are retrieved again.
-----Original Message-----
From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU]On Behalf Of
Patrice Nolin
Sent: Wednesday, April 07, 2004 6:01 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: RE : Calculation of interdependent virtual attributes
Hi Karen,
We thought about something similar after sending the message. But we st=
ill
have a problem because the object is used in a loop. The 1st time it wi=
ll
be
ok, but if the data change in the system and we use INITIAL, it wont be=
updated.
Also, we are force to use an attribute for calculation because the loop=
is
a
sequence of screens and we don't want to cut the flow by using a backgr=
ound
method for calculation in a task.
Thanks
Pat
-----------------------------------------------------------------------=
-----
Patrice Nolin, M.Sc.A. (courriel : nolin.patrice at hydro.qc.ca)
-----Message d'origine-----
De=A0: Weaver, Karen [mailto:Karen.Weaver at Sonopress.com]
Envoy=E9=A0: mercredi 7 avril 2004 16:52
=C0=A0: SAP-WUG at MITVMA.MIT.EDU
Objet=A0: Re: Calculation of interdependent virtual attributes
Couldn't you try the following:
OBJECT ...
(See attached file: private,)....
GET_PROPERTY HQ_B CHANGING CONTAINER.
IF object-private-hq_c IS INITIAL.
PERFORM set_hq_c.
ENDIF.
SWC_SET_ELEMENT CONTAINER 'hq_b' object-private-hq_c.
END_PROPERTY.
GET_PROPERTY HQ_A CHANGING CONTAINER.
IF object-private-hq_c IS INITIAL.
PERFORM set_hq_c.
ENDIF.
SWC_SET_ELEMENT CONTAINER 'hq_a' 2.
END_PROPERTY.
FORM set_hq_c.
object-private-hq_c =3D 1.
ENDFORM.
-----Original Message-----
From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU]On Behalf Of
Patrice Nolin
Sent: Wednesday, April 07, 2004 4:01 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Calculation of interdependent virtual attributes
Hi,
I have an object with 2 virtual attributes : hq_A and hq_B
The formula for hq_A is select table TABLE_X and count every row
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 sa=
me
data, I was thinking to put the code for calculation of hq_A and hq_B i=
n
HQ_A attribute, setting a private variable hq_C and initiating hq_B wit=
h
the
private variable hq_C (see example below):
My problem occurs when I use HQ_B before HQ_A because the content of th=
e
private variable is calculated when HQ_A is referenced.
Is there another way to calculate my variables, without causing perform=
ance
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 ...
(See attached file: private,)....
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> )
-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of=
the
information or copying of this message is prohibited. If you are not th=
e
addressee, please notify the sender immediately by return e-mail and de=
lete
this message.
Thank you.=
More information about the SAP-WUG
mailing list