Page 1 of 1

Inconsistent/bug when using nested Totals/summary functions

Posted: Wed Dec 13, 2023 9:10 pm
by InnoM
Hi,

Recently been migrating our old reports from Crystal to Stimulsoft recently and so far it's going well.

However, there is one thing that has thrown me which is to do with resolving expressions, specifically Totals functions.

For instance, take the following TextBox with the expression:

Code: Select all

{First(First(AgeBreaks.AgeBreak))}
This will throw an error when previewing that says "No overload of First accepts 1 argument".

However, if I create a variable with the same formula (minus the curly braces), and then use that in a TextBox, it works fine.

I first noticed this when trying to use a SumIf in conjunction with a First function in a TextBox expression:

Code: Select all

{Switch(
		DataSource1.AgeByDueDate == 1,
			SumIf(GroupHeaderBand1, DataSource1.OpenBillAmount,
	      		DataSource1.adItemAgeByDueDate <= (int)DataSource1[First(AgeBreaks.AgeBreak)]),
		
		DataSource1.AgeByDueDate != 1,
			SumIf(GroupHeaderBand1, DataSource1.OpenBillAmount,
	      		DataSource1.adItemAgeByItemDate <= (int)DataSource1[First(AgeBreaks.AgeBreak)])
		)
}
Which fails with the same error.

I've attached a sample report which shows this effect. If you try to preview, it will fail. If you delete the first TextBox with First(First(...)), it will render just fine, despite using a Variable with the same expression.

Is there a reason for this behavior? Should I be using a different function?

Kind Regards

Re: Inconsistent/bug when using nested Totals/summary functions

Posted: Thu Dec 14, 2023 9:03 pm
by Lech Kulikowski
Hello,

> This will throw an error when previewing that says "No overload of First accepts 1 argument".

You use the First() function twice. Please check:
{First(AgeBreaks.AgeBreak)}

Thank you.