Discussion created by parasynOSIpi on May 22, 2014
Latest reply on May 23, 2014 by xwang

Is there a simple/standard way to get a tag alias for PIACEPOINT


I am trying to determine the correct version of a module and retrieve tags using aliases.


I have a block of code which correctly identifies the alias for a pi ace point but it only works for the first iteration when doing a recalculation over a time period.


I have a module where I have attached different versions at 23:45, 00:00 and 00:15


So if I try to recalc between 23:30 and 00:30 recalcing values every 15 mins the I am trying to look up the specific version at the right time, then look up the new tag for the alias for that version then get the data for that tag.  Sounds simple enough right ??


So when I get the right version I am calling:




                PIACEPoint pt = new PIACEPoint();
                pt = point;

                moduleOlderVersion = GetPIModule(point.ExeTime);
                PIACETagInfo tag = NGER.TagUtilities.GetPIACETagInfo(point);               


                string alias = tag.AliasName;
                string tagname = point.Tag;
                alias = alias.Substring(alias.IndexOf(@"\") + 1);

                pt.SetTag(Path, moduleOlderVersion.PIAliases[alias].DataSource.Name, TagAliasUsedType.TagAliasAsInput);


                return pt;


Unfortunately the first time the code runs through this alias is correct, the second time alias = tagname, so of course setTag call fails because the tagname does not exist in the module as an alias.




So my question is there a better way to get the piacepoint tag alias.


I could hard code the alias and pass it into this method but I was really hopeing to not have to do that.