dbTalk Databases Forums  

SetGenFiltered TCursor and movetoRecord

comp.databases.paradox comp.databases.paradox


Discuss SetGenFiltered TCursor and movetoRecord in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Craig
 
Posts: n/a

Default Re: SetGenFiltered TCursor and movetoRecord - 02-19-2007 , 05:31 AM






Anders,
Thank you for your reply.
Your answer is what I needed. Two TCursors on the same table. I'll have to
create the index in OPAL because the table on which I will work is the
result of a query (To get the proper data I query two tables and use the
answer table. This happens at the beginning and is the only query in the
scenario).
I will work on this in the next few days (during my copious free time) and
see if I can do it.
Craig
"Anders Jonsson" <gt3TakeThisAway (AT) bredband (DOT) net> wrote

Quote:
Craig,

Not entirely sure I follow what you want to do, but you certainly don't
need several copies of the table. Instead you can open several tCursor
against the same table but use different indexes and ranges.

If you have a secondary index that includes HospitalID, PatiendID and
DateOfVisit you could do something

1) Open a tcursor against the table.

2) Open another tCursor against the same table but with the secondary
index.

3) Scan the first tCursor, for each record in that one do a setRange with
the secondary tcursor, using exact match for HospitalID, PatientID and a
range form DateOfVisit.

4) Check out the the records in the range and see how many returning
visits and add them to a temporary result table for a report.


Not sure my explanation is clear enough but I hope it will point you in
the right direction.

I think it's essential that you create the correct secondary indexes as
setRange often is MUCH quicker than setGenFilter and queries and if you
have many records it will make a huge difference in performance.

Anders







Reply With Quote
  #12  
Old   
Jean Friedberg
 
Posts: n/a

Default Re: SetGenFiltered TCursor and movetoRecord - 02-20-2007 , 08:06 AM






Craig,

Make a secondary index on the main table with Patient Number and Admission
DateTime. Add a field called "Last Discharge DateTime" to the table. Add a
second field called "Elapsed Hours".

Query the table to generate a unique set of Patient Numbers. Use a tcursor
to scan this table of Patient Numbers.

Set up a second tcursor on your main table. Using tcursor #1, use set range
to isolate Patient Number. Use tcursor #2 to scan the resulting set of
records and fill/calculate in the "Last Discharge DateTime" and "Elapsed
Hours" fields. Come back to the newsgroup if you need help calculating
Elapsed Hours.

Finally, query the main table for Elapsed Hours less than target value
(e.g., 48 hours) to generate those instances in which the patient bounced
back.

Time to write the code and run it should be less than 15 minutes.

Jean

"Craig" <craig.futterman (AT) nospam (DOT) comcast.net> wrote

Quote:
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





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.