7 Replies Latest reply on Oct 10, 2018 5:11 PM by srikanth.nadikatla

    Custom data reference output attribute causing issues with analyses

    srikanth.nadikatla

      Hello,

       

      We have a custom data reference to pull compmax and excmax properties of PiPoint which are inputs to analyses. The analyses evaluates fine but the calculation results as well as preview shows "calc failed" for the custom data reference input. Any advise If I am missing something?

       

      Below is the code for CDR

          public class PIProperties : AFDataReference

          {

       

              public override AFValue GetValue(object context, object timeContext, AFAttributeList inputAttributes, AFValues inputValues)

              {

      AFValue inputstring = inputValues[0];

       

      PIPoint tag;

      String value;

      PIServers piServers = new PIServers();

       

      tag = inputstring.Attribute.PIPoint;

      tag.LoadAttributes(TagProperty);

      value = tag.GetAttribute(TagProperty).ToString();

      return new AFValue(value, DateTime.Now);

              }

       

              public string TagProperty { get; set; }

       

              private void ReadConfigString(string value)

              {

      TagProperty = value;

       

              }

       

              private string CreateConfigString()

              {

      return string.Format("{0}", TagProperty);

              }

       

              public override string ConfigString

              {

      get

      {

      return CreateConfigString();

      }

       

      set

      {

      ReadConfigString(value);

      SaveConfigChanges();

      }

              }

       

       

              public override AFAttributeList GetInputs(object context)

              {

      AFAttributeList inputs = new AFAttributeList();

       

      inputs.Add(this.Attribute.Parent);

       

      return inputs;

              }

       

          }