# IsResultComputed

## IsResultComputed(X)

Returns True (1) when the result value for variable «X» has already been computed and is currently cached in memory, False (0) otherwise.

When evaluated from Mid-Mode, it returns true when the Mid-value of «X» is already computed. When evaluated from Sample-Mode, it returns true when the Sample-value of «X» is already computed. Hence, the following two forms test specifically for Mid or Sample:

Sample(IsResultComputed(X))
Mid(IsResultComputed(X))

## Notes

Generally if you attempt to read the value of the midValue or probValue attributes, using e.g., midValue of «X», it will trigger the computation of «X» if the value is not already computed. This function is required to circumvent this problem.

From ADE, this function is also the method for testing whether a value is already computed and cached. You can do this either from typescript, e.g.:

ade.SendCommand("IsResultComputed(Va1)")

or you can use the CAObject::Evaluate method, e.g.:

CAObject va1 = ade.Get("Va1");
if (va1.Evaluate("IsResultComputed(Va1)").AtomicValue()) {
...
}