Ashok_NK

AFCalculation "Bad Calc" Latest Interval

Discussion created by Ashok_NK on Aug 9, 2013
Latest reply on Aug 15, 2013 by mhamel

 Hi

 

I am able to get the latest value of an attribute using:

 
AFAttribute afAttribute = AFAttribute.FindAttribute(@"ABC\Station\X01|Pressure", afDatabase);
var val = afAttribute.GetValue(new AFTime(DateTime.UtcNow));

 But when I have a simple calculation across two attributes, it comes back as "bad calc":

 
string testExpression = @"'ABC\Stations\X01|Pressure A' / 'ABC\Stations\X01|Pressure B'";
var testExpressionResult = AFCalculation.CalculateAtTimes(server, testExpression, new[] { new AFTime(DateTime.UtcNow) });

 How can I do such a calculation? 

 

In this instance, it's a simple calculation. I could retrieve the individual attribute values and do the calculation myself - but am curious, why doesn't the above calc work?

 

Thanks

Outcomes