CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Totals on page

Print topic Send  topic

Author Message
LV
Posted: 05/19/2004, 11:14 AM

Does anyone know how to create the totals for the numeric fields on the List page?

Thanks in advance.

peterr


Posts: 5971
Posted: 05/19/2004, 11:21 AM

Do you need a column with totals for each row? Or one total for everything? Or one total per page?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
LV
Posted: 05/19/2004, 7:46 PM

For now I need the grand total for the entire column, for example I have a column called Amount , I need to show the grand total at the bottom or anywhere on the page is fine, of course if I change the search filter the total should change too based from my search selection.

Thanks for looking into this. Any guidance is much appreciated.
Stan
Posted: 05/19/2004, 11:41 PM

You can find such examples in CCS Help > Examples and Techniques > Programming > Simple Reporting
peterr


Posts: 5971
Posted: 05/20/2004, 1:21 AM

Another method could be to place a Label on your page and then assign the Total/Sum value to it. For example in VB.NET create "After Execute Select " event:
Dim TableCommand As New TableCommand(("select sum(*) from table",_Select.WhereTemplate,_Select.Dao)  
sumCommand.Parameters = CommonParameters  
System.Web.HttpContext.Current.Session("SumValue") = sumCommand.ExecuteScalar()

Then in the label's "Before Show" event:
LabelName.Text = Session("SumValue").ToString()

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
LV
Posted: 05/20/2004, 10:36 AM

Thanks all for the information. I like Peterr solution, which I will try as soon as I get a chance.
LV
Posted: 05/20/2004, 11:31 AM

Peterr,

Please check the syntax for me, sorry I am still new to all of these so be patient

Here is my settings:
Form Name: Test1
My Search Form Name: BondsSearch
My List Form Name: Bonds
I have two controls: Bond_No and Bond_Amount

As you suggested I created a Lable and call it: TotalBondAmount
I then add this code to the List Form Before Execute Select

Dim TableCommand As New TableCommand(("select sum(*) from table",_Select.WhereTemplate,_Select.Dao)sumCommand.Parameters = CommonParameters
System.Web.HttpContext.Current.Session("SumValue") = sumCommand.ExecuteScalar()

and add the event to my label control before show
TotalBondAmount.Text = Session("SumValue").ToString()

I get this error when I try build the page
===============================================
C:\DOCUME~1\vu_lo\LOCALS~1\Temp\~BondTracking\Test1.aspx.vb(260) : error BC30451: Name 'TotalBondAmount' is not declared.



TotalBondAmount.Text = Session("SumValue").ToString()

~~~~~~~~~~~~~~~

C:\DOCUME~1\vu_lo\LOCALS~1\Temp\~BondTracking\components\Test1DataProvider.vb(311) : error BC30198: ')' expected.

Dim TableCommand As New TableCommand(("select sum(*) from table",_Select.WhereTemplate,_Select.Dao)sumCommand.Parameters = CommonParameters
~

C:\DOCUME~1\vu_lo\LOCALS~1\Temp\~BondTracking\components\Test1DataProvider.vb(311) : error BC30205: End of statement expected.

Dim TableCommand As New TableCommand(("select sum(*) from table",_Select.WhereTemplate,_Select.Dao)sumCommand.Parameters = CommonParameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\DOCUME~1\vu_lo\LOCALS~1\Temp\~BondTracking\components\Test1DataProvider.vb(312) : error BC30451: Name 'sumCommand' is not declared.

System.Web.HttpContext.Current.Session("SumValue") = sumCommand.ExecuteScalar()
~~~~~~~~~~
C:\DOCUME~1\vu_lo\LOCALS~1\Temp\~BondTracking>REM _End MakeAll

====================================

Can you help me with the syntax
Does the code need to be on the same line?

Thanks advance for your help

peterr


Posts: 5971
Posted: 05/20/2004, 12:07 PM

The error message indicates a problem with TotalBondAmount. Is this the Label that you added? Did you add it inside the Grid or outside the Grid? The syntax would be different inside the grid, for example:
GridNameLabelName.Text = Session("SumValue").ToString()

For more info on referencing the controls refer to http://docs.codecharge.com/studio/html/ProgrammingTechn...ntrolValue.html
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.