Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate total values when check column on grid is true
Message
 
 
To
31/07/2007 14:37:29
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01244964
Message ID:
01244971
Views:
22
>Hello comunity
>
>I have a form based on tsql cursor. On my grid , i have a column to check (TRUE/FALSE)
>and on this column i have the following code.
>
>LOCAL lctotal as Double
>lctotal = 0
>SELECT CCHEQUES ->(is my Cursor)
>DO CASE
>case thisform.grid1.column1.check1.Value = 1
>	thisform.grid1.column5.Text1.Value = THISFORM.Cmb1EMP.Value
>	thisform.grid1.column7.Text1.Value = THISFORM.Cmb2DO.Value
>	SELECT ccheques
>	IF thisform.grid1.column1.check1.Value = 1
>	lctotal = lctotal + thisform.grid1.column6.Text1.Value
>	endif
>otherwise
>	thisform.grid1.column5.Text1.Value = " "
>	thisform.grid1.column7.Text1.Value = " "
>ENDCASE
>	thisform.total.Value = lctotal	
>thisform.grid1.Refresh
>
>SELECT ccheques
>if thisform.grid1.column1.check1.Value = 1
>lctotal=lctotal + ccheques.valor
>endif
>thisform.total.Value = lctotal	
>thisform.grid1.Refresh
>
>this code is on procedure "Interactivechange" and "LostFocus" but simply my textbox TOTAL show mw only the value of first row and don´t make a SUM of (thisform.grid1.column6.Text1.Value).
>Could someone give me an ideia or a simple example.
>
>Many thanks
>Luis Santos

It is not clear what exactly you're trying to do, but one simple thing you should remember - don't use column's text.value use table.field in all your calculations and analysis.

Do you want to calculate totals for the whole grid or put totals in an extra column of the grid?

If the former, you may check class by Dorin Vasilescu in Downloads section here.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform