How to perform advance calculation and validation on matrix field?