Please, Please help with Grand Totals

  • Thread starter Thread starter Coleen
  • Start date Start date
C

Coleen

Hi All :-)

Thanks for all of your help Cor :-)

I can not get the code you sent me to work in my application. I'm using an aspx datagrid in a web form. I'm getting the following error message when I try this code:

"Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier."

Dim dr2 As DataRow = dt_stat_report_3b.NewRow
Dim sum As Double = CDbl(dt_stat_report_3b.Compute("Sum(10-ld_act_125_gtr_fy_hh_avg)", ""))
dr2(10) = sum
dt_stat_report_3b.Rows.Add(dr2)
dt_stat_report_3b.Columns(11).Expression = "10-ld_act_125_gtr_fy_hh_avg" & sum.ToString
uwg_stat_rpt_3b.DataSource = dt_stat_report_3b

By way of explanation, I already have a For loop defined, and the columns created to hold both the values I'm trying to get the grand total for and the "Sum" column so I'm not showing that code. The column name is "10-ld_act_125_gtr_fy_hh_avg" and is the (10) column in the datagrid. The grand total column is the (11) column in the datagrid. I'm not multiplying by 100, because I don't want the actual percentage here, I want the calculation of the value from the row of column(10) divided by the grand total of column(10), so I don't need to multiply by 100.

Do you have any suggestions? I am at a loss, and at this point I'm going to have to duplicate all of my calculations from this datagrid and do them over again in a second datagrid, because the value in column 10 is calculated from column 3 and 4 in the current datagrid. This is basically a replication of an Excel Spreadsheet that our users have and they want an automated report. In order to get that report, I have to do calculations in almost EVERY column of this datagrid, and the datagrid consists of 14 columns! If you can provide any suggestions as to why I'm getting this error, I would greatly appreciate your help.

Thanks,

Coleen
 
Coleen,

Why do you not try that sample, everything is in it what you ask.
And again I added in the original thread that one sentence you need what is needed more for a webform than for a winform in this case.

Cor
 
Coleen,

Again,

Why are you sending everytime the same message while you are not looking to
the answers or trying the advises you get.

Cor
 
I am having trouble with my newsgroup viewer...it is not showing me all threads! I did get the project to work, but when I applied the code you sent to my application I got the error I sent in this thread. I have a databind for this data grid after all of the compute code, I just did not show it. I don't understand why I am getting the error "Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier. "

The line of code is:

Dim sum As Double = CDbl(dt_stat_report_3b.Compute("Sum(10-ld_act_125_gtr_fy_hh_avg)", ""))

Where I have described the column "Perc" as a double instead of an integer because I need to return decimal values, so I declared the variable sum as a double instead of an integer as well. dt_stat_reprt_3b is the name of the datatable that I am using in my page for the datagrid. "10-ld_act_125_gtr_fy-hh_avg" is the name of the column that I need the grand total for. So I have implemented the code you sent me, and I DO appreciate it VERY much. I'm just puzzled as to why I get this error when running the page. I don't get it in the test project using the code you sent, even after I changed the Integers to doubles, and took out the * 100 in the sample, it still works. I'm not quite sure why it is expecting a "Child qualifier?"


Thanks,

Coleen
Coleen,

Why do you not try that sample, everything is in it what you ask.
And again I added in the original thread that one sentence you need what is needed more for a webform than for a winform in this case.

Cor
 
I am having trouble with my newsgroup viewer, so I can't tell when someone
replies to my original post! I'm sorry to send double-posts, but I can't
read more than 5 threads. I apologize, If there are more than 5 threads in
my post, my viewer won't show me the thread. I've tried viewing in the
Microsoft Web forum, but our Network prevents me from signing in and
replying to posts that are shown there. I am looking at everything that I
can VIEW in my Outlook viewer, and trying it, but if I can't view it, I
can't try it :-(

Sorry.

Coleen
 
Coleen

This is yours
Dim sum As Double =
CDbl(dt_stat_report_3b.Compute("Sum(10-ld_act_125_gtr_fy_hh_avg)", ""))

This is in my sample
CInt(dt.Compute("Sum(Fig)", ""))

It are not only the doubles you changed I cannot immagen that
(10-ld_act_125_gtr_fy_hh_avg) is a column name

Cor
 
Actually, that IS the column name, but you are right, the 10- in it is the
reason I was having so much trouble. It was trying to do a subtraction
before it did the division because of the dash! Thanks so much for your
help and code. After going over the code step by step and looking at the
column name, I first took out the 10- and it all fell into place! Cor, you
are a genius, and my hero :-)

THANKS SO VERY MUCH!

Coleen

BTW, I use such weird column names to describe the variable that is the
result of the calculation. In this case it stands for local double
(ld)_actual (act)_125(a tax rate)_greater than(gtr)_fiscal year(fy)_hold
harmless(hh)_average(avg) - it makes sense, but it IS cumbersome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top