Total for value with both numeric and string conditions

Stimulsoft Reports.WEB discussion
Post Reply
JHenn
Posts: 20
Joined: Fri Jun 01, 2018 9:23 pm

Total for value with both numeric and string conditions

Post by JHenn »

Please see the two statements below.

varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo ? Dataset.Charges :0);
varSum2 = Totals.Sum (DataDataset, Dataset.BA_Name == varBA ? Dataset.Charges :0);

varSum, varSum2, varMo, and varBA are variables (varBA is a string, the other three are integers or decimals). Each one of these statements works correctly separately. I need to apply both conditions to a single instance of the total, but I have not been able to figure out the correct structure to combine them. What do you recommend?

Thank you for for your assistance.

~ Judy H.
Judy Hennessey / PrecisionBI
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Total for value with both numeric and string conditions

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data for analysis.

Thank you.
JHenn
Posts: 20
Joined: Fri Jun 01, 2018 9:23 pm

Re: Total for value with both numeric and string conditions

Post by JHenn »

I figured it out, thanks. I was trying to go with

varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo && DataDataset, Dataset.BA_Name == varBA ? Dataset.Charges :0);

I had the && concatenator figured out, but I also had to remove the second instance of the databand name.

varSum = Totals.Sum (DataDataset, Dataset.InvServiceDt_IMonth == varMo && Dataset.BA_Name == varBA ? Dataset.Charges :0);
Judy Hennessey / PrecisionBI
Lech Kulikowski
Posts: 6266
Joined: Tue Mar 20, 2018 5:34 am

Re: Total for value with both numeric and string conditions

Post by Lech Kulikowski »

Hello,

Thank you for the information.
Post Reply