MichaelvdV@Atos

Obtain Annotations from AFValue object in AFDataReference

Discussion created by MichaelvdV@Atos on Mar 13, 2009
Latest reply on Mar 17, 2009 by spilon

I am quite new to AF SDK Development, so maybe this is a silly question...

 

I am creating a DataReference (derive from AFDataReference).

 

This DataReference should (according to the configuration) select one AFValue. It can be configured to return a configured (by Attribute Name) value, but it should also be able to select an AFValue depending on an Annotation.

 

Please consider the following code:

public override AFValue GetValue(object context, object timeContext, AFAttributeList inputAttributes, AFValues inputValues)
{
    if (inputValues.Count == 1 && SelectorMode == StreamSelectorMode.Single)
        return inputValues[0];
    else if (inputValues.Count > 1 && SelectorMode == StreamSelectorMode.Single)
    {
        AFValue val1 = inputValues[0];
        AFValue val2 = inputValues[1];

         return double.Parse(val1.Value.ToString()) > double.Parse(val2.Value.ToString()) ? val1 : val2;
    }
    return inputValues[0];
}

At this point, it just selects the highest value (if 2 values are present). This should be a selection based on an Annotation. The AFValue object does contain an 'Annotated' bool, but I am unable to find out how to obtain the actual annotation.

 

The help file references to an example, but I cannot find this example.

 

Can anyone point me to the right direction/example?

Outcomes