Your recipe formula validation issue requires addressing all four key areas - formula validation constraints, dynamic constraint evaluation, CAD specification linking, and constraint cache synchronization:
1. Formula Validation Constraints Configuration
The constraint definition must use dynamic expressions, not static values. Modify your recipe type definition:
<ConstraintExpression name="toleranceCheck">
value="${linkedCADSpec.tolerance}"
dynamic="true" cacheRefresh="onDemand"
</ConstraintExpression>
This ensures constraints are evaluated at validation time, not cached at creation time.
2. Dynamic Constraint Evaluation Setup
Enable the dynamic evaluator in site.xconf:
<Property name="wt.formula.constraint.evaluationMode" value="dynamic"/>
<Property name="wt.formula.constraint.resolveLinks" value="true"/>
The resolveLinks property is critical - it forces the validator to fetch current values from linked CAD specs rather than using cached references.
3. CAD Specification Linking Configuration
Your recipe-to-CAD-spec links must use ‘latest version’ semantics:
- In the recipe template, set the CAD spec link type to ‘DynamicReference’
- Configure version selection rule: ‘Latest Released’ or ‘Latest in State’
- This ensures validation always uses current CAD spec data
Update existing recipes with this script:
// Pseudocode - Update recipe CAD links:
1. Query all recipes with CAD spec links
2. For each recipe, get current CAD spec reference
3. Replace static reference with dynamic reference
4. Update link configuration to use latest version
5. Trigger constraint cache refresh
// See Recipe Management Guide Section 7.4
4. Constraint Cache Synchronization
Implement automatic cache invalidation when CAD specs change. Create an event listener:
Register in site.xconf:
<Service name="CADSpecUpdateListener"
class="com.custom.formula.CADSpecEventHandler"/>
The listener should:
- Monitor CAD specification update events
- Identify all recipes linking to the updated spec
- Invalidate constraint cache for those recipes
- Optionally trigger re-validation if recipes are in active workflows
Immediate Fix for Your Specific Error:
Your error shows tolerance=±0.05mm with actual=0.03mm, which should pass but fails. This indicates the constraint is comparing absolute values incorrectly. Check your constraint expression:
Incorrect:
actualValue <= toleranceValue
Correct:
abs(actualValue - nominalValue) <= toleranceValue
The validator needs to compare deviation from nominal, not raw values.
Validation and Testing:
After implementing these changes:
- Create a test recipe with CAD spec link
- Validate the recipe - should pass
- Update the linked CAD spec tolerance values
- Re-validate the recipe without modification
- Verify it uses new tolerance values from CAD spec
The combination of dynamic evaluation, proper linking configuration, and cache synchronization will resolve your constraint violation issues. The event listener is the long-term solution for keeping formulas synchronized with evolving CAD specifications.