Implement @LINE@ script in print format item (#1280)

This commit is contained in:
Carlos Ruiz 2022-04-05 04:35:52 +02:00 committed by GitHub
parent 190240ae4c
commit 5d15bcf3ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -1306,7 +1306,7 @@ public class DataEngine
if (expression == null || expression.length() == 0)
return "";
log.info("Analyzing Expression " + expression);
if (log.isLoggable(Level.CONFIG)) log.config("Analyzing Expression " + expression);
String token;
String inStr = new String(expression);
StringBuffer outStr = new StringBuffer();
@ -1351,6 +1351,17 @@ public class DataEngine
Object value = ((PrintDataElement)tokenPDE).getValue();
outStr.append(value);
}
else if (token.equals("LINE"))
{
BigDecimal value = Env.ONE;
if (m_summarized.containsKey(pdc))
{
value = ((BigDecimal)m_summarized.get(pdc)).add(value);
m_summarized.remove(pdc);
}
m_summarized.put(pdc, value);
outStr.append(value);
}
inStr = inStr.substring(j+1, inStr.length()); // from second @
i = inStr.indexOf('@');