Inconsistent/bug when using nested Totals/summary functions

Stimulsoft Ultimate discussion
Post Reply
InnoM
Posts: 4
Joined: Fri Sep 29, 2023 12:41 pm

Inconsistent/bug when using nested Totals/summary functions

Post 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
Attachments
Sample Report.mrt
(8.67 KiB) Downloaded 123 times
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

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

Post 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.
Post Reply