Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count the records
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01310624
Message ID:
01311749
Views:
28
>Naomi my problem is sloving but some thing is must i want.
>in filed. rcord is like.
>studentid 1200 A,A,P,P,P,A,A,A,A,A,A,(datewise)in filed
>studentid 1201 A,A,P,P,P,A,A,A,A,A,P,(datewise)in filed
>Now i want to select if student make absence as ajasent for studentid 1200,
>should be ignore fo 1201 studentid because after 5 absence student is prasent.
>I am alos replacing with date.
>thanks for you and your thinking.

I see. If that's the case, I believe, you need to use procedural programming using scan loop, e.g. something like:
create cursor curAbsentees (StudentID, Absences I)
select myTable
set order to StudentID
lnAbsences = 0
lcStudentID = ""
scan
  if not m.lcStudentID = StudentID
      if m.lnAbsences >=5 
             insert into curAbsentees values (m.lcStudentID, m.lnAbsences)
     endif           
     lnAbsences = 0

     lcStudentID = StudentID
  endif
  if Category = 'A'
    lnAbsences = m.lnAbsences + 1
  endif
  if Category <> 'A'
     lnAbsences = 0
  endif
endscan
From the top of my head and not tested. Somehow I always forget the technique to process the last user as well. In my case you would need to add some post-processing code after the loop, e.g.
if m.lnAbsences >=5 && Last StudentID
   insert into ...
endif
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform