Summary Expressions

Stimulsoft Reports.WEB discussion
Post Reply
tourquse
Posts: 7
Joined: Sun Aug 07, 2022 5:55 pm

Summary Expressions

Post by tourquse »

Hi,

I am trying to write a conditional SumIf expression where the condition compares column values to a variable.

I have gotten as far as the below expression, which returns the value zero. Can anyone please let me know where I have gone wrong?

{SumIf(DataSource2.Sales,DataSource2.WeekEndingDate == DateTo)}

DataSource is my data source.
Sales is the column I'd like to sum. The data type is decimal.
WeekEndingDate is the column I'd like to filter by comparing to a variable. The data type is datetime.
DateTo is my variable. The Data type is datetime.

Perhaps there is a syntax issue or a data type conversion issue with my expression?

Thanks :D
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Summary Expressions

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
tourquse
Posts: 7
Joined: Sun Aug 07, 2022 5:55 pm

Re: Summary Expressions

Post by tourquse »

Hi, sample report attached. I am aware that there are other ways of solving this problem using filters and bands etc but I would like to solve this entirely within each expression as both a learning exercise and since it aligns with my real-life requirement.

I would like each text box in FooterBand1 to return the desired result that you should be able to understand from the context and my attempt at writing a valid formula :lol:

Thanks
Attachments
Report (4) (1) (1).mrt
(35.78 KiB) Downloaded 78 times
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Summary Expressions

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more detail?

Thank you.
tourquse
Posts: 7
Joined: Sun Aug 07, 2022 5:55 pm

Re: Summary Expressions

Post by tourquse »

Basically I am having trouble writing the 'Condition' part of a SumIf summary formula (see screenshot).

In the condition I am trying to match column values to a variable. I have checked that the data types are the same in the column and the variable.

The example report I sent through has some formulas in the FooterBand1 which don't return a value because I am not writing my conditions correctly. Can you please help me get those formulas to work.
Attachments
Screenshot 2022-11-30 115049.png
Screenshot 2022-11-30 115049.png (31.89 KiB) Viewed 789 times
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Summary Expressions

Post by Lech Kulikowski »

Hello,

You can use the following expression:
{SumIf(DataBand2,DataSource2.Calls,DataSource2.WeekEnding == DateTo)}

Thank you.
Attachments
Screenshot 2022-11-30 093145.png
Screenshot 2022-11-30 093145.png (196.17 KiB) Viewed 780 times
Post Reply