wrong calculation on multiple instances

If you think that something doesn't work in Aware IM post your message here
Post Reply
tkilshaw
Posts: 170
Joined: Thu Jan 19, 2006 11:33 pm
Location: Western Canada
Contact:

wrong calculation on multiple instances

Post by tkilshaw »

using build 760 on Windows XP

the following rule of object Goal, used on an instance of Goal which has 3 ProgressGoals and the following starting values:

Goal.AccountTarget set to 200

ProgressGoal[1].Percentage set to 10
ProgressGoal[2].Percentage set to 5
ProgressGoal[3].Percentage set to 2

ProgressGoal[1].NumAccounts = 20
ProgressGoal[2].NumAccounts = 10
ProgressGoal[3].NumAccounts = 4

If I change Goal.AccountTarget the following rule is applied:

If Goal.AccountTarget WAS CHANGED Then
FIND ProgressGoal WHERE ProgressGoal IN Goal.ProgressGoals
ProgressGoal.NumAccounts=Goal.AccountTarget*ProgressGoal.Percentage/100

After application we have:

Goal.AccountTarget changed to 100

ProgressGoal[1].Percentage set to 10
ProgressGoal[2].Percentage set to 5
ProgressGoal[3].Percentage set to 2

ProgressGoal[1].NumAccounts = 10
ProgressGoal[2].NumAccounts = 10
ProgressGoal[3].NumAccounts = 10

So for some reason the value calculated for the first ProgressGoal instance is applied to all ProgressGoal instances.

Is my code wrong?

thanks,

Terry
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Terry,

your rule is fine. We have tried to reproduce the problem using the latest build (762) and the version of your business space that we've got and everything works correctly. There was a small problem fixed in build 762 that might affect it. Could you please download it and check if the problem still occurrs. If it does, could you send us the latest version of your business space and tell us the steps you are doing to reproduce the problem.

Best Regards
Aware IM Support Team
tkilshaw
Posts: 170
Joined: Thu Jan 19, 2006 11:33 pm
Location: Western Canada
Contact:

Post by tkilshaw »

I tried build 762 but the problem persists.

I'll send my code to Vladimir.

Terry
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

We will be fixing this problem. In the meantime you can do the following - move the rule that re-calculates percentages from the Goal object to the ProgressGoal object, so instead of having the following rule on Goal:

If Goal.AccountTarget WAS CHANGED Then
FIND ProgressGoal WHERE ProgressGoal IN Goal.ProgressGoals
ProgressGoal.NumAccounts=Goal.AccountTarget*ProgressGoal.Percentage/100

you will have the following rule on ProgressGoal:

If ProgressGoal.Goal.AccountTarget WAS CHANGED Then
ProgressGoal.NumAccounts=ProgressGoal.Goal.AccountTarget*ProgressGoal.Percentage/100

This will be more correct conceptually as well as you should try to put rules that modify objects on the objects being modified.

Best Regards
Aware IM Support Team
Post Reply