API Reference > Other Classes > OdFdFieldEvaluator Class > OdFdFieldEvaluator Methods > OdFdFieldEvaluator::evaluate Method
OdFdFieldEvaluator::evaluate Method
Syntax
C++
virtual OdResult evaluate(OdDbField* pField, int nContext, OdDbDatabase* pDb, OdFdFieldResult* pResult) const = 0;
Parameters 
Description 
OdDbField* pField 
[in] Input field to evaluate  
int nContext 
[in] Input context in which the field is evaluated; this context flag is passed to the evaluator and can be one of the predefined OdDbField::EvalContext enum flags or a user-defined context flag  
OdDbDatabase* pDb 
[in] Input database pointer, which can be null if a database could not be obtained in the current context  
OdFdFieldResult* pResult 
[in] Input field result object to set the evaluation result and status 

This function is called by the field framework when the field needs to be evaluated.

A field will be evaluated only when the evaluation option set in the field matches the context in which the field evaluation is invoked. For example, if a field option is set to evaluate only manually, then it will be evaluated only when the user updates the specific field or all fields in the drawing manually. 

The evaluator should evaluate the field and set the evaluated value using OdFdFieldResult::setFieldValue() and the error status using OdFdFieldResult::setEvaluationStatus() in the passed result object, which in turn will set them in the field object. 

The passed database pointer may be null if the field is not database resident and a database could not be obtained in the current context. If the field evaluation requires a database, then this method can set the evaluation error status in the field result object and return an error. 

If the evaluation fails for any reason, the previously cached result in the field object can be left intact and used as the field value. Alternatively, the cached result can be deleted and substituted with an error string (for example, "#ERR"), which will be displayed as field value. 

 

Copyright © 2002–2020. Open Design Alliance. All rights reserved.