sandeep.narang

System.__ComObject is coming as value of digital tag

Discussion created by sandeep.narang on Jun 2, 2012
Latest reply on Jun 4, 2012 by hanyong

Hi Team

 

 

 

We are using following piece of code to fetch the values of PI tags.

 
Array EVP = this.eventPipe.TakeAll();
                    if (EVP.Length > 0)
                    {
                        foreach (Object _obj in EVP)
                        {
                            EO = _obj as PIEventObject;
                            _ptValue = (PointValue)EO.EventData;
                            _value = _ptValue.PIValue;
                            if (_value.Value is DigitalState)
                            {

                                 log.Debug("Received at " + _ptValue.PIValue.TimeStamp.LocalDate.ToString("MM/dd/yyyy hh:mm:ss.fff") + ", Group Name : " + this._groupName + ", Event: " + _ptValue.PIPoint.Name + ", " + ((DigitalState)_value.Value).Name + ", Filter Passed : " + filterPassed.ToString() +", ServerName="+this.serverPath );
                                                               
                            }
                            else
                            {
                                   log.Debug("Received at " + _ptValue.PIValue.TimeStamp.LocalDate.ToString("MM/dd/yyyy hh:mm:ss.fff") + ", Group Name : " + this._groupName + ", Event: " + _ptValue.PIPoint.Name + ", " + Convert.ToString(_value.Value) + ", Filter Passed : " + filterPassed.ToString() + ", ServerName=" + this.serverPath);
                                
                            }
                        }
}

 The issue is that we are getting the value as "System.__ComObject" when we try to get the value of a digital tag using '((DigitalState)_value.Value).Name'

 

 

 

Please correct me if I am doing anything wrong.

 

 

 

Thanks and Regards

 

Sachin

Outcomes