ejcrosalesg

AF SDK GetValue returns null value for only attributes declared as PI Points

Discussion created by ejcrosalesg on Feb 21, 2012
Latest reply on Feb 22, 2012 by Mike Zboray

The development team has implemented within a .NET code a function that reads the AF with AF SDK commands.

 

This function returns values for attributes declared as Table Lookup, Rollup, Formula.....but alwyas returns NULL values for those attributes declared as PI Points even though the tags have values. The followind code is the one being used by the development team:

 

Te la envío así como lo tengo… la siguiente función obtiene valores de atributos, cuando el atributo hace referencia a un PIPoint, regresa null:

 

 

 
private string GetAFAttributeValue(AFElement node, string attName, string sDate)
{ 
    string value = null; AFAttributeList listAtt = AFAttribute.FindElementAttributes(myDB, node, node.Name, null, null, AFElementType.Any, attName, null, TypeCode.Empty, false, AFSortField.Name, AFSortOrder.Ascending, 1);

    if (listAtt.Count > 0)
    { 
        DateTime dtDate = new DateTime(Convert.ToDateTime(sDate).Year, Convert.ToDateTime(sDate).Month, Convert.ToDateTime(sDate).Day, 0, 0, 0, 0);

        AFValue afValue = listAtt[0].GetValue(dtDate.ToUniversalTime());

        if (afValue.IsGood) value = afValue.Value.ToString().Trim();
    }
    return value;
}

 

 

 

 

 

 

Please let me know why is this problem being presented and possible solutions. Thanks.

Outcomes