IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyCorel Paradox / ObjectPAL Coding BoardObjectPAL Topic   Print This     

Two TCursors problem

Two TCursors problem in ObjectPAL topic (part of our Corel Paradox / ObjectPAL Coding group).

Quick Search: TCursors   problem   Two TCursors   Two TCursors problem  
Leo
Civilized Africa

Is it at all possible to open two Tcursors on the same table? I have a situation where I have to set a range on a table to find specific records. Then I have to scan through those records one by one and I have to compare them with all the other, to output the groups that go together. I’m thinking I’ll try a second Tcursor to open inside the range and make that scan through the records as well. Then I can compare the Tcursors with each other. Does any one know if this is possible, is there a better way to do this and what would the code look like, especially to open a Tcursor inside a range that’s set up on a first Tcursor? Any help will be greatly appreciated.

Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9649, 15 replies
Thread Started 5/22/2003 5:54:00 AM
View Counter=4215
Last Reply Posted 6/5/2003 9:14:00 PM)
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  
rt
Castel, -- UK
So, at the end of the day what happens when the 'third party' says you are not doing what they wanted?

Thats enough of that. Ed.

 Posted 18 years ago
Comment Quote
About rt -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About rt

I do like my jazz and blues!


Post ID #9676 (Level 1.1)  Reply to 9649
Thread Started 5/27/2003 4:23:00 AM
View Counter=2
Location=Castel, -- UK 
Joined=21 years ago   MB Posts=687   KB Comments=1  
rt
Castel, -- UK
"Does this mean that after all that time I spent preparing that clear concise and well thought through explanation of my problem, no one at all understands it?"

In a word, Yes.

Mac, you were very brave to ask for further details of this one, so over to you... Roll Eyes

Thats enough of that. Ed.

 Posted 18 years ago
Comment Quote
About rt -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About rt

I do like my jazz and blues!


Post ID #9683 (Level 1.2)  Reply to 9649
Reply Posted 5/30/2003 6:41:00 AM
Location=Castel, -- UK 
Joined=21 years ago   MB Posts=687   KB Comments=1  
rt
Castel, -- UK
Leo, this sounds more than a little despondent Big Grin!

"Thanx for all the help I've ever received from you all. If you don't see me posting here often now, be good to Dante for me"

Paradox can certainly be a pain at times, but it sounds as though it might be a case of sorting out your boss this time - can you not face him\her\it with a second opinion?

Smile :)

Thats enough of that. Ed.

 Posted 18 years ago
Comment Quote
About rt -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About rt

I do like my jazz and blues!


Post ID #9686 (Level 1.3)  Reply to 9649
Reply Posted 6/2/2003 2:22:00 AM
Location=Castel, -- UK 
Joined=21 years ago   MB Posts=687   KB Comments=1  
Rick Carter
Cincinnati OH USA
Sure you can. Of course, that second tCursor will take up some more memory and resources. But you can do so judiciously. Matter of fact, I'll admit I've got some old code (still running) that creates lots of tCursors when the form opens, and leaves them all open until the form closes. I wouldn't do that today, but nobody wants to give me the time to rewrite that program, since it still works OK and doesn't show any noticeable performance degradation.
Rick Carter
Chair, Delphi/Paradox SIG
Cincinnati PC Users Group
 Posted 18 years ago
Comment Quote
About Rick Carter -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #9658 (Level 1.4)  Reply to 9649
Reply Posted 5/22/2003 11:17:00 AM
Location=Cincinnati OH USA  
Joined=20 years ago   MB Posts=518  
Al
Brooklyn, New York, USA
Forget the two TCursors. Can you state exactly what it is that you want to accomplish
 Posted 18 years ago
Comment Quote
About Al -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9674 (Level 1.5)  Reply to 9649
Reply Posted 5/26/2003 5:29:00 PM
Location=Brooklyn, New York, USA  
Joined=20 years ago   MB Posts=24  
The Big Jerm
 (Inactive)
Texas
I did that once on a table with 10,000 records. It so it had to cycle 100,000,000 times. Needless to say it was pretty slow. I re-wrote it using queries:

First I queried they table to __temp.db with no criteria, so I had an exact copy of the table.
Then I wrote a query that joined the two tables on all the fields I wanted to match.

main.db | field 1 | field 2 | field 3 |
| check _a | check _b | check _c |

__temp.db| field 1 | field 2 | field 3 |
| check _a | check _b | check _c |

This will give you all the matching records.
 Posted 18 years ago
Comment Quote
About The Big Jerm -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #9659 (Level 1.6)  Reply to 9649
Reply Posted 5/22/2003 1:27:00 PM
Location=Texas  
Joined=20 years ago   MB Posts=88  
Langley McKelvy
Harris County Texas, USA
Here is my wild assed guess as to how I would approach this.

I would restructure the table by adding a shortInt (1 or 0) field called Match - note: I use this instead of a logical, since there are other occasions where adding the 1's together makes things easier. Then I'd do a nested scan loop, checking for Matches as I went. After it was done for each record, I'd query against the matched records and get a result set. Like BJ says, this would probably take quite some time on a large table. You may want to throw up a cursor shape during the process.

var
tc1, tc2 tCursor
qVar query
tv tableView
endvar
;
if not tc1.open(":myAlias:theTable.db")
then errorShow()
return
endif
;
if not tc2.open(":myAlias:theTable.db")
then errorShow()
tc1.close()
return
endif
;
if not tc2.edit()
then errorShow()
tc1.close()
tc2.close()
return
endif
;
scan tc1:
;
scan tc2:
;
if tc2."theField" = tc1."theField"
then tc2."Match" = 1
else tc2."Match" = 0
endif
;
endScan
;
qVar = Query

:myAlias:theTable.db | theField | someotherField | Match |
| Check | Check | 1 |

EndQuery
;
if not qVar.executQBE(":priv:answer.db)
then errorShow()
return
endif
;
tv.open("priv:answer.db"); just an example, you could do anything here.
;
endscan
;
tc1.close()
tc2.endEdit()
tc2.close()
Mac

[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
 Posted 18 years ago
Comment Quote
About Langley McKelvy -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Langley McKelvy
Computer Crimes Investigator / Computer Forensics Specialist Paradox for DOS/Windows Programmer

Post ID #9665 (Level 1.7)  Reply to 9649
Reply Posted 5/23/2003 7:07:00 AM
Location=Harris County Texas, USA  
Joined=19 years ago   MB Posts=387  
Langley McKelvy
Harris County Texas, USA
Anybody get that? Confused Big Grin!

Leo, why don't you post the table structures as they currently exist (or a similar brief example), then a corresponding field list for the output file. Maybe that will give us some ideas about how to help. I'm thinking that BJ is probably right - this sounds like a job for a query if we can work out the dynamics.
Mac

[i]"A king will have his way in his own hall, be it folly or wisdom."[/i] - Gandalf
 Posted 18 years ago
Comment Quote
About Langley McKelvy -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Langley McKelvy
Computer Crimes Investigator / Computer Forensics Specialist Paradox for DOS/Windows Programmer

Post ID #9678 (Level 1.8)  Reply to 9649
Reply Posted 5/28/2003 8:11:00 AM
Location=Harris County Texas, USA  
Joined=19 years ago   MB Posts=387  
Leo
Civilized Africa
Tony I need to check for an EXACT mach on ONE column. But I have to check all the records against all others. I only need to work with the matches. Unfortunately records from the first Tcursor are expected to have multiple matches in the second Tcursor. I suggested using a parent and child table to store the data from the start so I’d never have to find the matches, I could simply set a range on the table and have all the matches for free. Unfortunately the DB admin has a reason for having the table link back onto itself. Setting the range on both Tcursors should narrow down the searchable field to less than 40 records so optimising for efficiency is not that high a priority. Jeremy if the Tcursors don’t do it for me I’ll go study up on my queries again and do it like you said. Thanx for all the help and good suggestions guys. I’d be lost with out ya’ll :)
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9662 (Level 1.9)  Reply to 9649
Reply Posted 5/22/2003 11:40:00 PM
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  
Leo
Civilized Africa
I think I lost my bearings so I’m starting to wonder why do we need two TCursors at all? It looks to me like we’re doing everything on the same table. I initially proposed two TCursors because I though I could put a range on the one, open the second one on that first one and add another range to what was already selected, i.e. do a search on the search results with setRange(). Now that I’ve tried it I see it’s not going to work that way. In the example above that Mac made there’s no setRange at all. Does that mean we don’t need the second TCursor? I suppose it will run faster if I can get along with only one. It seems I managed to confuse myself completely.

My output is to a text stream. On several occasions I run into the problem that a field must have the number of sub fields that is going to follow it in the field before I open the sub field. This is getting a bit frustrating cause it never looked this complicated.
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9673 (Level 1.10)  Reply to 9649
Reply Posted 5/26/2003 7:39:00 AM
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  
Leo
Civilized Africa
I just have to make sure to thank Mac for trying to help so far. That’s a good question Al. It's got a long and complicated answer that I'm not going into.
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9675 (Level 1.11)  Reply to 9649
Reply Posted 5/27/2003 12:41:00 AM
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  
Leo
Civilized Africa
My users don't get paid! And that would be kinda pointless since the system is intended to facilitate the getting paid part. harrrrrrrrr
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9677 (Level 1.12)  Reply to 9649
Reply Posted 5/27/2003 11:13:00 PM
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  
Leo
Civilized Africa

Anybody get that?

Does this mean that after all that time I spent preparing that clear concise and well thought through explanation of my problem, no one at all understands it? Geez what a knock to my self-esteem Big Grin! HEHE

I suppose I don’t understand it well because it’s highly complicated and long, that’s why I have trouble explaining what the problem is exactly.

Mac I’m not quite clear on how I can post my table structure. Can I post ERDiagrams or like UML on here somehow? Or should I type it out?
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9681 (Level 1.13)  Reply to 9649
Reply Posted 5/29/2003 11:26:00 PM
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  
Leo
Civilized Africa
Thanx for all the help people. I never said before that I have a B.Sc IT degree so this stuff is not new to me - i had a whole year course on database design. My employers are unfortunately not this fortunate and for some reason won't take my word on it. If I sound bitter it's cause I am way frustrated. Worried Thanx for all the help I've ever received from you all. If you don't see me posting here often now, be good to Dante for me. He'll be needing a lot of help when this is Bomb! over.
C Ya'll Big Grin!
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9685 (Level 1.14)  Reply to 9649
Reply Posted 6/1/2003 11:23:00 PM
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  
Most Recent Post
Leo
Civilized Africa
No worries Tony. And thanx for the help with the other issues. Your name is in the coments for helping to sort that one out. I gave up on trying to sort out my boss and I up and quit, right 2 months before the deadline. I had so much stress I was getting an ulcer, so I prioritised and found my health was more important than my job. If I ever need help with OPAL again Il be sure and ask you people. Il never understand why someone would hire a person with a degree and then not listen to him. I didn intend for it to sound like I was blaming you people for anything. Good Luck to yal
Another Leo
_ _ ___________________ _ _
We are Micro$oft
You will be assimilated
Resistance is futile
 Posted 18 years ago (Thread Starter)
Comment Quote
About Leo -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #9691 (Level 1.15)  Reply to 9649
Reply Posted 6/5/2003 9:14:00 PM
Location=Civilized Africa  
Joined=19 years ago   MB Posts=96  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P184A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #9649 Counter
4215
Since 4/2/2008

Regarding...

Linked Knowledge Base Article.

This thread is linked to the following KB article.


Mike Prestwood
1. Using ObjectPAL's TCursor Object Type

Exploring ObjectPAL's TCursor object type.

Posted to KB Topic: OPAL: Language Details
13 years ago, and updated 12 years ago
(2 KB Comments)

KB Post
Nothing New Since Your Last Visit
41019
Hits

Corel Paradox / ObjectPAL Coding

Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2021 Prestwood IT Solutions.   [Security & Privacy]