if (parameters.length > 0)
{
String name = parameters[0].toString();
if (parameters[0] instanceof ContextLookup)
{
final ContextLookup context = (ContextLookup) parameters[0];
name = context.getName();
}
for (int j = 0; j < reportFunctions.length; j++)
{
if (reportFunctions[j] instanceof FormulaExpression)
{
final FormulaExpression reportExp = (FormulaExpression) reportFunctions[j];
if (reportExp.getName().equals(name))
{
LValue val = parser.parse(reportExp.getFormulaExpression());
while( !(val instanceof ContextLookup))
{
if (val instanceof Term)
{
val = ((Term)val).getHeadValue();
}
else if (val instanceof FormulaFunction)
{
final FormulaFunction reportFunction = (FormulaFunction) val;
val = reportFunction.getChildValues()[0];
}
}
if (val instanceof ContextLookup)
{
final ContextLookup context = (ContextLookup) val;
name = context.getName();
}
break;
}
}
}