Page 1 of 1
"Sum" problems
Posted: Tue Mar 18, 2008 10:45 am
by donnie
Hi Guys,
I'm a new with this stuff. i tried to create a report to which a dataset is binded
report.RegData(ds);
within my query i have a join between 2 tables let say goups (id, group, total...) and sub-groups (group, name, ...)
when i generate the report by grouping (group) it gives something like this
id ------- group -------- total ------- name sub-group
1 ------- 0001 -------- 20$ ------- x
1 ------- 0001 -------- 20$ ------- y
1 ------- 0001 -------- 20$ ------- z
1 ------- 0255-------- 10$ ------- a
1 ------- 0255 -------- 10$ ------- b
here's my prob. i want a subtotal of 30$ (20 + 10) but i can't do it !!!!!!!!
if i use the SUM property it gives 80$ OR depending where i put it, it gives me 2 subtotals 60$ and 20$
what can i do to solve this tiny porblem !!!
"Sum" problems
Posted: Tue Mar 18, 2008 4:31 pm
by Vital
Hello,
Sorry, i'm not fully understand. You need calculate only first row from each group?
Thank you.
"Sum" problems
Posted: Wed Mar 19, 2008 8:52 am
by donnie
Vital wrote:Hello,
Sorry, i'm not fully understand. You need calculate only first row from each group?
Thank you.
I need to calculate the SUM of my "total" column. According to the example here, I need a total of 30$ (20 + 10).
the porblem with SUM, it returns the total of ALL columns (20+20+20+10+10) depending where i put it on the report !
thx
"Sum" problems
Posted: Wed Mar 19, 2008 9:30 am
by Edward
wrote:I need to calculate the SUM of my "total" column. According to the example here, I need a total of 30$ (20 + 10).
Unfortunately still not clear. Please send your report template (a mrt file, can be saved in Stimulsoft Reports.Net Designer) to support[at]stimulsoft.com.
We'll help you as soon as possible, it seems not a difficult question, but we need to understand the requirement first.
Thank you.
"Sum" problems
Posted: Wed Mar 19, 2008 9:56 am
by donnie
header
grouping (group)
id ------- group -------- total ------- name sub-group
1 ------- 0001 -------- 20$ ------- x
1 ------- 0001 -------- 20$ ------- y
1 ------- 0001 -------- 20$ ------- z
End grouping (if sum here the total = 60$ !!!!!!!!!!!!!!!!!!!!! I need 20$ as a total)
footer
header
grouping (group)
id ------- group -------- total ------- name sub-group
1 ------- 0001 -------- 20$ ------- x
1 ------- 0001 -------- 20$ ------- y
1 ------- 0001 -------- 20$ ------- z
End grouping
footer(if sum here the total = 60$ !!!!!!!!!!!!!!!!!!!!! and it's not what i want !!!! i want 20$)
header
grouping (group)
id ------- group -------- total ------- name sub-group
1 ------- 0001 -------- 20$ ------- x
1 ------- 0001 -------- 20$ ------- y
1 ------- 0001 -------- 20$ ------- z
End grouping
footer
if sum here the total = 40$ !!!!!!!!!!!!!!!!!!!!! WRONG again !!! it gives me the total of the last 2 rows
"Sum" problems
Posted: Wed Mar 19, 2008 11:05 am
by Vital
Please send your report template to
support@stimulsoft.com.
Thank you.
"Sum" problems
Posted: Wed Mar 19, 2008 11:15 am
by Vital
Hello!
Please create in report dictionary two variables: GroupValue and PrevID.
After then in BeginRenderEvent of GroupHeaderBand write following code:
After then in RenderingEvent of GroupHeaderBand write following code:
Code: Select all
if (PrevID == -1 || PrevID != MyDataSource.ID)
{
PrevID = MyDataSource.ID;
GroupValue += MyDataSource.Value;
}
After then in total text component you need type:
Thank you.
"Sum" problems
Posted: Thu Mar 20, 2008 10:55 am
by donnie
All riiight
i found a solution and i don't need a SUM property, i use Variables, pure & simple (var1 += var2)
thx anyways !