![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
In the following code snippet, the TCursor dosen't move to the next record which is record lio+1 The code steps through the line with the errorshow, but it doesn't show the error.. This is part of a Scan Loop with a different TCursor (P10) Thanks in advance. Craig snip dyn["HospitalNumber"] = stNewMR tcBounce1.setGenFilter(dyn) licount = TCBounce1.nrecords() If licount <2 then;// if less than 2 records nothing to compare..move on to next patient Loop ENDIF For lio from 1 to liCount-1 TCBounce1.movetoRecord(lio) dtDCDatetime = TCBounce1."DCdateTime" If not TCBounce1.movetoRecord(lio+1) then ;// <---this does not happen!!!! errorshow("Could not move to record "+STrval(lio +1));// <-- the errorshow show doesn't show return Else dtAdmitDateTime = TCBounce1."AdmitDateTime" ENDIF snip |
#3
| |||
| |||
|
|
*assumes nRecords() works right on a filter, I'm not sure. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Craig, why not using a scan-loop instead? You could avoid the setGenFilter by using the for-clause of then scan like: scan TCBounce1 for TCBounce1."HospitalNumber"=stNewMR etc... endScan Egbert |
#6
| |||
| |||
|
|
Craig, why not using a scan-loop instead? You could avoid the setGenFilter by using the for-clause of then scan like: scan TCBounce1 for TCBounce1."HospitalNumber"=stNewMR etc... endScan Egbert |
#7
| |||
| |||
|
|
That would make it slightly harder to do what he wants as he needs to go to record #1, read a value, then inside the loop, go to record #2 and compare it to record #1, then repeat for every pair of records (or something like that). This kind of thing is easier in a loop where you control the record movement rather than the loop controlling it. Given what Anders had to say, I'm guessing a secondary index and setRange would simplify life greatly. FWIW, Liz |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
Liz, Egbert and Anders, Thanks, as always, for your replies. After doing a query which combines two tables from a specified time frame, I am going through each of the records, one by one, and looking for records which have the same medical record number and comparing the discharge datetime with the admission datetime of the next record. The goal is looking for patients who come back to the ICU within a specified period of time (24 or 48 hours). The purpose is to investigate why kids "bounce back" in a short period of time. According to what you suggest, I will have to create an index on the hospital number field after the query which creates the table. Then, as I go through the table with a scan loop, set the range for the hospital number, compare records and find the "bouncebacks". I have to reset the range each time the big scan loop goes to the next patient. Does that sound correct? Can I go through a scan loop of the entire table and use set range after each record? Thanks for helping me with this complex project. Craig |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |