haziq

Calculate Multiple Contexts into Single Output

Discussion created by haziq on Apr 19, 2011
Latest reply on Apr 25, 2011 by Daniel Takara

Hi guys, I have known that "ACE Context" can be used to utilize the same VB code and apply across other context created in MDB. I wonder if there's a method to calculate the sum of tags' value into a single tag, as example:

 
Dim TotalSum, Condition1, Condition2
TotalSum = 0
Condition1 = 0
Condition2 = 0

 

 

...

 
If Tag.Value >= 0 Then 
TotalSum = TotalSum + Tag.Value
If TagCondition.Value = "1"
Condition1 = Condition1 + Tag.Value
ElseIf TagConidition.Value = "2"
Condition2 = Condition2 + Tag.Value
End If
End If

 

 

..so the if statement were duplicated over and over until all tags in the area is used.

 
TotalTag.Value = TotalSum
TotalCondition1.Value = Condition1
TotalCondition2.Value = Conditiion2

 

 



In a single calculation currently, I have to replicate at least 40-50 times and I know this work is redundant to be implemented across other areas consist of similar numbers of tags to be totaled of.

Regards,
Haziq

Outcomes