Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Danson Danson
  Where is Danson Danson?
 Nairobi
 Kenya
 Danson Danson
 Tags
Subject: RE: Grid in VFP 9.0
Thread ID: 233127 Message ID: 233221 # Views: 29 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Tuesday, June 30, 2009 5:10:05 PM         
   


> Thanks Stefan, the code worked perfectly....thanks alot and God bless you

You are welcome.

> But i have another problem,
> 1. What is the best way to sum numeric values in a grid eg i have a grid called grid1 with six columns: No, name, marks1, marks2, total,and grade.
> I want to sum values of 'marks1' and 'marks2' and store them in 'total' and then grade the total and store the text value like "pass" or "fail" in 'grade' column
>

That kind of calculations can be presented as "calculated columns", for instance in a View or CursorAdapter, or temporary "Select ... Into Cursor ..."
(With a VFP back-end) the ICASE() expression would be in the SQL field list in that case, perhaps surrounded by Cast().
That way you do not need to store the redundant values in tables persistently.



> 2. When am grading the value in the 'total' column i also need to check if columns 'marks1' and 'marks2' have values or are empty and then grade the total based on this. In other words, if the student did not sit for one of the exam, that means either 'marks1' or 'marks2' is empty, then the grade should be "Course not complete". I hope you got it. Thanks.
>

It's also a calculated result like the one above, right? If you'd post your data structure as a
Create Cursor yourTable (marks1 L, marks2 L, total I ...

... statement, and add a few sample-data lines:
Insert Into yourTable Values (...


and describe the desired result, then surely me or someone else will post an SQL example if you like.

(BTW, I'd suggest to start a new thread for a new question to get more attention.)


hth
-Stefan



COMPLETE THREAD
Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 8:30:07 AM
RE: Grid in VFP 9.0 Posted by kulwant singh @ 6/30/2009 9:26:03 AM
RE: Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 1:54:41 PM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 6/30/2009 9:58:13 AM
RE: Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 11:32:07 AM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 6/30/2009 3:17:47 PM
RE: Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 4:14:34 PM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 6/30/2009 5:10:05 PM
RE: Grid in VFP 9.0 Posted by ron philippo @ 7/1/2009 7:39:00 PM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 7/1/2009 7:50:40 PM
RE: Grid in VFP 9.0 Posted by Anders Altberg @ 6/30/2009 10:09:52 AM