Using ACE to import tags in code and not using ACE Wizard

Discussion created by gpriyanka on Oct 9, 2009
Latest reply on Dec 18, 2009 by tinklerj



I am having the issues with my ACE calculation. The calculation does not have any input tags. Instead the tags are imported in the code itself. While testing I get the values I expect. However, I am getting wrong values in real-time. The reason I do not have any input tags is because the calculation is used by several contexts, and each context has different number of input tags.


The code goes through each alias in the context, if certain conditions are met for the alias, then the alias and its associated tag are added to a hashtable. For the main calculation, the tags are then retrieved from the hashtable.




Private HDStatus As System.Collections.Hashtable
Private HDAlias As PISDK.PIAlias
_Module = GetPIModuleFromPath(Context)

Private Sub initializeHDStatus()

'Clear the Hashtable>

If HDStatus Is Nothing Then
    HDStatus = New System.Collections.Hashtable
End If

'Go through each alias in context in Module Database

For Each HDAlias In _Module.PIAliases
If HDAlias.Name.ToUpper.EndsWith("HD") Then
    HDStatus.Add(HDAlias.Name, New PIACEPoint _
        (HDAlias.DataSource.Server.Name, HDAlias.DataSource.Name, _
End If>


End Sub

I wanted to know if anyone has used this method and if you have had a problem with it. Are there any alternatives to this?


One alternative that I can think is to input the maximum number of input aliases in the calculation (If context1 has 4 inputs and context2 has 10 input tags, then I will input 10 aliases, then 6 input aliases for context1 will not have any associated input tags). Then I can have a property for each context which has the number of input tags. The code will then look at the property value and go through the calculation accordingly.


I do not like this alternative for a few reasons. One, context1 will have invalid input tags, that might generate errors and slow down the process. I could have dummy tags for the invalid input tags which may cause confusion later. Second, the code will become a little bit more complicated and longer. Right now my main code is pretty short, I go through the hashtable using a for loop and use a single condition to test every alias/tag in the table.