public void visitOperationCalllExpBegin(OperationCallExp exp) { var operation = exp.getReferredOperation(); if (operation == null) { return; } // get type of operation string operationName = operation.getName(); OperationCallExpImpl operationCall = (OperationCallExpImpl)exp; bool isBasicOperator = operationCall.isBasicOperator(operationName); bool isBooleanOperator = operationCall.isBooleanOperator(operationName); if (isBooleanOperator) { formula += ","; } else if (isBasicOperator) { formula += string.Format(" {0} ", operationName); } }
public void visitOperationCalllExpBeforeBegin(OperationCallExp exp) { var operation = exp.getReferredOperation(); if (operation == null) { return; } // get type of operation string operationName = operation.getName(); OperationCallExpImpl operationCall = (OperationCallExpImpl)exp; bool isBasicOperator = operationCall.isBasicOperator(operationName); bool isBooleanOperator = operationCall.isBooleanOperator(operationName); var source = operationCall.getSource(); // boolean operators or not basic operators (because boolean operator is a basic operator) if (isBooleanOperator || !isBasicOperator) { // set formula name based on operation name string xoperationname = operationName; // map operation name to formula name based on source expression if (source is AssociationEndCallExpImpl || source is IteratorExpImpl) { if (operationName.Equals("size")) { xoperationname = "COUNTIFS"; } else if (operationName.Equals("sum")) { xoperationname = "SUMIFS"; } } else if (source is VariableExpImpl) { formula += string.Format("[{0}]", operationName); } else { if (operationName.Equals("size")) { xoperationname = "COUNTA"; } else if (operationName.Equals("sum")) { xoperationname = "SUM"; } else if (operationName.Equals("toDate")) { xoperationname = ""; // suppress toDate operation } } if (!(source is VariableExpImpl)) { formula += xoperationname.ToUpper(); } } if (!(source is VariableExpImpl)) { formula += "("; } }