try
{
final String expression = exp.getFormulaExpression();
if ( expression == null)
continue;
final FormulaFunction function = (FormulaFunction) parser.parse(expression);
final LValue[] parameters = function.getChildValues();
if (parameters.length > 0)
{
String name = parameters[0].toString();
for (int j = 0; j < reportFunctions.length; j++)
{
if (reportFunctions[j] instanceof FormulaExpression)
{
final FormulaExpression reportExp = (FormulaExpression) reportFunctions[j];
if (reportExp.getName().equals(name))
{
final LValue val = (LValue) parser.parse(reportExp.getFormulaExpression());
if (val instanceof FormulaFunction)
{
final FormulaFunction reportFunction = (FormulaFunction) val;
final ContextLookup context = (ContextLookup) reportFunction.getChildValues()[0];
name = context.getName();
}
else if (val instanceof Term)
{
final Term term = (Term) val;