Don't try to compute aggregates on virtual fields - that is, try-catch around the lookup of such fields

This commit is contained in:
2024-04-18 18:21:32 -05:00
parent 66cf485c41
commit 8c27bb7a49

View File

@ -704,8 +704,24 @@ public class GenerateReportAction extends AbstractQActionFunction<ReportInput, R
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
for(String fieldName : record.getValues().keySet()) for(String fieldName : record.getValues().keySet())
{ {
QFieldMetaData field = null;
try
{
//////////////////////////////////////////////////////
// todo - memoize this, if we ever need to optimize //
//////////////////////////////////////////////////////
FieldAndJoinTable fieldAndJoinTable = getFieldAndJoinTable(table, fieldName); FieldAndJoinTable fieldAndJoinTable = getFieldAndJoinTable(table, fieldName);
QFieldMetaData field = fieldAndJoinTable.field(); field = fieldAndJoinTable.field();
}
catch(Exception e)
{
//////////////////////////////////////////////////////////////////////////////////////
// for non-real-fields... let's skip for now - but maybe treat as string in future? //
//////////////////////////////////////////////////////////////////////////////////////
LOG.debug("Couldn't find field in table qInstance - won't compute aggregates for it", logPair("fieldName", fieldName));
continue;
}
if(StringUtils.hasContent(field.getPossibleValueSourceName())) if(StringUtils.hasContent(field.getPossibleValueSourceName()))
{ {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")