CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Why is "summ" not properly Adding up!!

Print topic Send  topic

Author Message
African Prince
Posted: 04/08/2004, 3:16 PM

Greetings to the house!
When i tried to use the "summ" example in codecharge tutorials to calculate
the sum of label values in a grid form,the total label always returns an
incorrect sum.
Can anybody help me figure this out?
Regards,
Charles

Jason2
Posted: 09/08/2004, 9:56 AM

Itīs happends the same to me...
Thereīs an answer to this?

Please Help....!
dataobjx


Posts: 181
Posted: 09/08/2004, 10:39 AM

Post your functions (Before_Show_Row event, etc) and we'll have a look.
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
Jason2
Posted: 09/08/2004, 12:09 PM

I tried this:

Function ORCT_BeforeShowRow() 'ORCT_BeforeShowRow
'Custom Code
ORCT.GranTotal1.Value = ORCT.GranTotal1.Value + ORCT.DocTotal.Value + ORCT.Alt_DocTotal.Value
' -------------------------
'End Custom Code

End Function 'Close ORCT_BeforeShowRow

and this:
Dim Summ
Function ORCT_BeforeShowRow() 'ORCT_BeforeShowRow

Summ = Summ + (ORCT.DocTotal.Value + ORCT.Alt_DocTotal.Value)
ORCT.GranTotal1.Value = Summ

End Function 'Close ORCT_BeforeShowRow

it sums the records twice (exept the last record), like this

1+2+3+4+5 = 25 because it sums 1,2,3 and 4 twice...

ASP, IIS, SQL
Jason2
Posted: 09/09/2004, 7:55 AM

Hi guys....

I was expecting at least a "I will check" from someone in the staff of YesSoftware (I mean Peterr) but this absolute silence make me think that this is really a bug in CCS, and Yes dont want to talk about it.

So I have a big problem, I allredy presented the site to my boss, recomend CCS, and he loved it; now, I have to figure out how to tell him that the software I describe him as "excelent" cant do somethin as simple as totalizing a grid.

And worst, I have to start from cero all my pages in pure asp...! I did one of them, and it totalized the grid, so Itīs proved that the problem is in CCS.

I followed the sample (Summ) and it didnt work...! Who in Yes checks this samples before they are published....?
dataobjx


Posts: 181
Posted: 09/09/2004, 9:13 AM

Jason2,

Two things, first.
1) This forum - although monitored and sometimes answered by YesSoftware is actually for developers to help one another... so don't be suprised if YS doesn't respond... other developers usually will do that.

2) Don't tell your boss anything of the sort as it's not a bug but rather the method that you are using that is failing.

If you're not yet a member of http://www.dataobjx.net - then register and send us the code.

To supply the code - do the following.

After you login, click the Document Manager Link then the Post Files link.

Upload the project files (.zip them up) and when you get to the page of the wizard that asks if you want to allocate the files to specific individuals select that link. Then assign the file to DataObjx from the list box.

Also, after doing that - click the email link found at the bottom of any of the pages and let us know you've posted the files to us.
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
dataobjx


Posts: 181
Posted: 09/09/2004, 10:37 AM

Alternatively, do this;

1) add a label to the bottom of the grid - call the label "lblTotalForThisPage"

2) At the top of the page you have a subroutine called BindEvents;
Immediately after the End Sub dimension a global variable as follows;

Sub BindEvents()
Set ORCT..........
End Sub

Dim globalTotalForThisPage


In the before show row event for EACH row (e.g., if you're using alternate rows you need to put code in the before_show event as well)

Function ORCT_BeforeShowRow()
Dim lngAmountThisRow
lngAmountThisRow = INSUR_Insurance.datasource.recordset.fields("AMOUNT_FIELD_NAME")
gGrandTotal = gGrandTotal + lngAmountThisRow
End Function

Make sure you place this code in the before show row event for both rows if you're using alternate row sets.

Finally, in the before show event for the label (step 1) add the following code;

Function INSUR_Insurance_lblTotalForPage_BeforeShow()
INSUR_Insurance.lblTotalForPage.value = gGrandTota1
End Function

Let us know if that helps!
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
dataobjx


Posts: 181
Posted: 09/09/2004, 10:40 AM

Sorry, we left some legacy code that might be confusing in the previous post...

Alternatively, do this;

1) add a label to the bottom of the grid - call the label "lblTotalForThisPage"

2) At the top of the page you have a subroutine called BindEvents;
Immediately after the End Sub dimension a global variable as follows;

Sub BindEvents()
Set ORCT..........
End Sub

Dim globalTotalForThisPage


In the before show row event for EACH row (e.g., if you're using alternate rows you need to put code in the before_show event as well)

Function ORCT_BeforeShowRow()
Dim lngAmountThisRow
lngAmountThisRow = ORCT.datasource.recordset.fields("AMOUNT_FIELD_NAME")
globalTotalForThisPage = globalTotalForThisPage+ lngAmountThisRow
End Function

Make sure you place this code in the before show row event for both rows if you're using alternate row sets.

Finally, in the before show event for the label (step 1) add the following code;

Function ORCT_lblTotalForPage_BeforeShow()
ORCT.lblTotalForPage.value =globalTotalForThisPage
End Function

Let us know if that helps!

_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
Jason2
Posted: 09/09/2004, 1:04 PM

Thanks for your response, Iīm really desperate!!!!!!!!!!!!!!!!

can you please explain this lines:
lngAmountThisRow = INSUR_Insurance.datasource.recordset.fields("AMOUNT_FIELD_NAME")

And

How can I define the Before_Show_Row for a single row, it seems like you can only define it on the grid events:
Make sure you place this code in the before show row event for both rows if you're using alternate row sets.
Jason2
Posted: 09/09/2004, 1:15 PM

I tried to send you the files, please specify what you need;
the .asp .ccp .html and .ccs files (only the report) or all the project and My data base is SQL so I cant send you the data, what we can do?
Jason2
Posted: 09/09/2004, 1:34 PM

OK its almost done, the total is almost rigth except that it ignores the first value:
2+1+3=4 instead of 6, dont matter how long is the grid, it always ignores the firs row....
Jason2
Posted: 09/09/2004, 1:36 PM

Sorry, I was wrong it count the first row twice....
2+1+3=8 instead of 6
Tuong Do
Posted: 09/09/2004, 5:51 PM

You need to know which row number (odd or event) is the current row before
do the sum

For example If i is the the row number

<code>
'End Include Common Files
Dim i
Dim Summ
i = 0
Summ = 0
</code>

If the before show row event of the grid
<Code>
i = i + 1
If (i mod 2) = 1 Then
' An odd row
Summ = Summ + EventCaller.Amount.value
Else
' An even row
Summ = Summ + EventCaller.Alt_Amount.value
End If
</code>

In the before show event of the grid
<Code>
EventCaller.TotalLabel.value = Summ
</Code>



"Jason2" <Jason2@forum.codecharge> wrote in message
news:6413f39b405f39@news.codecharge.com...
> Itīs happends the same to me...
> Thereīs an answer to this?
>
> Please Help....!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

dataobjx


Posts: 181
Posted: 09/09/2004, 5:54 PM

Jason2

Your last response does not indicate whether you had success or not.

Where area we at, sir.
_________________
www.DataObjx.net
www.mydigitalapps.com
View profile  Send private message
dataobjx


Posts: 181
Posted: 09/09/2004, 5:56 PM

Jason2

Please send us an email atadministrator@dataobjx.net to enable communication
_________________
www.DataObjx.net
www.mydigitalapps.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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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