Page 1 of 1

Total for value with both numeric and string conditions

Posted: Thu Dec 20, 2018 4:15 am
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.

Re: Total for value with both numeric and string conditions

Posted: Sun Dec 23, 2018 10:36 am
by Lech Kulikowski
Hello,

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

Thank you.

Re: Total for value with both numeric and string conditions

Posted: Thu Dec 27, 2018 2:57 pm
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);

Re: Total for value with both numeric and string conditions

Posted: Fri Dec 28, 2018 1:12 am
by Lech Kulikowski
Hello,

Thank you for the information.