dbTalk Databases Forums  

Array of TCursor

comp.databases.paradox comp.databases.paradox


Discuss Array of TCursor in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
hswerdfe@gmail.com
 
Posts: n/a

Default Array of TCursor - 01-14-2009 , 01:54 PM






I am trying to use an array of TCursor
Sadly it is not working because TCursor does not derive from AnyType

I have something like (but not exactly) this

Var
tmpTC TCursor
arTC Array[] TCursor
EndVar

For i from 1 to tblStr.Size()
tmpTC.Open(tblStr[i])
tmpTC.Home()

arTC.AddLast(tmpTC)

endfor

I keep getting an error on the line "arTC.AddLast(tmpTC)" saying
"An error was triggered in the 'copyRecord' method on an object of
TCursor type.

Obviously, It is trying to copy the TCursor but all I want is a
pointer or reference copied.
I am new to ObjectPal so I don't know how these things a handled.

Basically I have several tables in several different directories which
all have the same structure, but diffent entries. I am trying to make
a script to Sync them.
and I thought starting with an array of all relevant tables would be a
good start, but even this is proving dificult

I am using Paradox 11 on XP
Thanks

Howie







Reply With Quote
  #2  
Old   
Mark Bannister
 
Posts: n/a

Default Re: Array of TCursor - 01-14-2009 , 02:17 PM






hswerdfe (AT) gmail (DOT) com wrote:
--
<p style="max-width: 605px;">Mark Bannister
<br>
President
<img src="http://www.injection-moldings.com/images/APPshadow-36dpi.jpg"
alt="APP Logo" moz-do-not-send="true" style="float: left; margin-top:
10px;">
<span
style="float: right;"><b>American Precision Products</b> * 520 Green
Cove Road * Huntsville, AL 35803-3011
<br>
800.889.7674x107 * 256.882-2121x107 fax: 800.341.9725 * 256.882-2414
<br>
Cell: 256.509.2052
<br>
<a
href="mailto:Mark (AT) Injection-Moldings (DOT) com">Mark (AT) Injection-Moldings (DOT) com</a>
<br>
<a
href="http://www.injection-moldings.com">http://www.injection-moldings.com</a>
* <a
href="ftp://ftp.injection-moldings.com/incoming">ftp.injection-moldings.com/incoming</a>
(anonymous)

<br>
Custom Injection Molding - Contract Manufacturing
</span></p>
<p style="clear: both;">&nbsp;</p>> I am trying to use an array of TCursor
Quote:
Sadly it is not working because TCursor does not derive from AnyType

I have something like (but not exactly) this

Var
tmpTC TCursor
arTC Array[] TCursor
EndVar

For i from 1 to tblStr.Size()
tmpTC.Open(tblStr[i])
tmpTC.Home()



Quote:
arTC.AddLast(tmpTC)
You have to attach the tc not use the array methods.
so either
artc.grow(1)
artc[i].Open(tblStr[i])
or
artc.grow(1)
tmpTC.Open(tblStr[i])
artc[i].attach(temptc)

Second example isn't much use in this example but shows how to attach an
existing tc.

FYI, you can also use dynamic arrays with tcursors so the subscript of
the array could be the table's name,
artc["mytablename"].open("mytablename")





Quote:
endfor

I keep getting an error on the line "arTC.AddLast(tmpTC)" saying
"An error was triggered in the 'copyRecord' method on an object of
TCursor type.

Obviously, It is trying to copy the TCursor but all I want is a
pointer or reference copied.
I am new to ObjectPal so I don't know how these things a handled.

Basically I have several tables in several different directories which
all have the same structure, but diffent entries. I am trying to make
a script to Sync them.
and I thought starting with an array of all relevant tables would be a
good start, but even this is proving dificult

I am using Paradox 11 on XP
Thanks

Howie







--
Mark B


Reply With Quote
  #3  
Old   
Jim Giner
 
Posts: n/a

Default Re: Array of TCursor - 01-14-2009 , 02:48 PM



Mark's answer is clever and does what you want (kindof). I can see where
you would want a pointer, but Mark gives you the actual opened tcursor.
Question is - can pdox handle all of the possible open tcursors you're going
to have? How many open tables do you ahve to sync up? And what exactly do
you mean by sync up? Are you trying to make the contents all identical?
Perhaps there's another approach.
<hswerdfe (AT) gmail (DOT) com> wrote

Quote:
I am trying to use an array of TCursor
Sadly it is not working because TCursor does not derive from AnyType

I have something like (but not exactly) this

Var
tmpTC TCursor
arTC Array[] TCursor
EndVar

For i from 1 to tblStr.Size()
tmpTC.Open(tblStr[i])
tmpTC.Home()

arTC.AddLast(tmpTC)

endfor

I keep getting an error on the line "arTC.AddLast(tmpTC)" saying
"An error was triggered in the 'copyRecord' method on an object of
TCursor type.

Obviously, It is trying to copy the TCursor but all I want is a
pointer or reference copied.
I am new to ObjectPal so I don't know how these things a handled.

Basically I have several tables in several different directories which
all have the same structure, but diffent entries. I am trying to make
a script to Sync them.
and I thought starting with an array of all relevant tables would be a
good start, but even this is proving dificult

I am using Paradox 11 on XP
Thanks

Howie









Reply With Quote
  #4  
Old   
hswerdfe@gmail.com
 
Posts: n/a

Default Re: Array of TCursor - 01-14-2009 , 03:31 PM



On Jan 14, 3:48*pm, "Jim Giner" <jim.gi... (AT) suny (DOT) edu> wrote:
Quote:
Mark's answer is clever and does what you want (kindof). *I can see where
you would want a pointer, but Mark gives you the actual opened tcursor.
Question is - can pdox handle all of the possible open tcursors you're going
to have? *How many open tables do you ahve to sync up? *And what exactly do
you mean by sync up? *Are you trying to make the contents all identical?
Perhaps there's another approach.<hswer... (AT) gmail (DOT) com> wrote in message

news:b5eedc5a-3c84-4df4-a6c6-62f944ddcc8d (AT) x14g2000yqk (DOT) googlegroups.com...

I am trying to *use an array of TCursor
Sadly it is not working because TCursor does not derive from AnyType

I have something like (but not exactly) this

Var
* tmpTC TCursor
* arTC Array[] TCursor
EndVar

For i from 1 to tblStr.Size()
*tmpTC.Open(tblStr[i])
*tmpTC.Home()

*arTC.AddLast(tmpTC)

endfor

I keep getting an error on the line "arTC.AddLast(tmpTC)" saying
"An error was triggered in the 'copyRecord' method on an object of
TCursor type.

Obviously, It is trying to copy the TCursor but all I want is a
pointer or reference copied.
I am new to ObjectPal so I don't know how these things a handled.

Basically I have several tables in several different directories which
all have the same structure, but diffent entries. I am trying to make
a script to Sync them.
and I thought starting with an array of all relevant tables would be a
good start, but even this is proving dificult

I am using Paradox 11 on XP
Thanks

Howie
I have about 10 tables
and by sync, yes I mean make them all identical

but there is no easy way to do this that I can see.
all the tables have some missing records and some other records that
have the same key have differences in the data portion of the records
that do exist.
I have an "Algorithm" to determine which table is the authority on
each record, but its not simple and relies on what the data in the
rest of the record looks like

I suppose I am doing more of a Merge into a single authoritative copy,
then copy back out the result.


Marks answer works and I am using it but I can't help but feel like I
am missing a "*" or "&" or "ByRef" or "new" or something in the
language that would make my future life in this language easier.


Reply With Quote
  #5  
Old   
Mark Bannister
 
Posts: n/a

Default Re: Array of TCursor - 01-14-2009 , 03:51 PM



<snip>
Quote:
Marks answer works and I am using it but I can't help but feel like I
am missing a "*" or "&" or "ByRef" or "new" or something in the
language that would make my future life in this language easier.
Well this explanation may be wrong (I often am) but I think this is the
correct way to look at it:
The issue is that there is only a single table that your TC's are
pointing to. They are all essentially pointers, I guess, to a
particular record. Attaching one tc to another is nearly instantaneous.
I've done test on this vs open and attaching is much faster. Once
attached the TC's are separate in that they can point to different
records. By separate I mean they can't act as pointers or by reference.
The only difference logic-wise between attaching and opening is that an
attached tc gets all the ranges/filters and current record and record
status of the existing tc.


--
Mark B


Reply With Quote
  #6  
Old   
Steven Green
 
Posts: n/a

Default Re: Array of TCursor - 01-15-2009 , 05:09 AM



Howie.. unfortunately, yes, you're missing plenty.. it's hard for us to know
your limits and knowledge, but your comments indicate very little OPAL
programming experience.. and a "data merge" concept that is NOT for
beginners.. why are you trying to use a platform that you aren't familiar
with?

--

Steven Green - Myrtle Beach, South Carolina USA

http://www.OasisTradingPost.com

Oasis Trading Post
- Collectibles and Memorabilia
- Vintage and Custom Lego Creations

Diamond Software Group
- Paradox Sales and Support

Diamond Sports Gems
- Sports Memorabilia and Trading Cards

<hswerdfe (AT) gmail (DOT) com> wrote

On Jan 14, 3:48 pm, "Jim Giner" <jim.gi... (AT) suny (DOT) edu> wrote:
Quote:
Mark's answer is clever and does what you want (kindof). I can see where
you would want a pointer, but Mark gives you the actual opened tcursor.
Question is - can pdox handle all of the possible open tcursors you're
going
to have? How many open tables do you ahve to sync up? And what exactly do
you mean by sync up? Are you trying to make the contents all identical?
Perhaps there's another approach.<hswer... (AT) gmail (DOT) com> wrote in message

news:b5eedc5a-3c84-4df4-a6c6-62f944ddcc8d (AT) x14g2000yqk (DOT) googlegroups.com...

I am trying to use an array of TCursor
Sadly it is not working because TCursor does not derive from AnyType

I have something like (but not exactly) this

Var
tmpTC TCursor
arTC Array[] TCursor
EndVar

For i from 1 to tblStr.Size()
tmpTC.Open(tblStr[i])
tmpTC.Home()

arTC.AddLast(tmpTC)

endfor

I keep getting an error on the line "arTC.AddLast(tmpTC)" saying
"An error was triggered in the 'copyRecord' method on an object of
TCursor type.

Obviously, It is trying to copy the TCursor but all I want is a
pointer or reference copied.
I am new to ObjectPal so I don't know how these things a handled.

Basically I have several tables in several different directories which
all have the same structure, but diffent entries. I am trying to make
a script to Sync them.
and I thought starting with an array of all relevant tables would be a
good start, but even this is proving dificult

I am using Paradox 11 on XP
Thanks

Howie
I have about 10 tables
and by sync, yes I mean make them all identical

but there is no easy way to do this that I can see.
all the tables have some missing records and some other records that
have the same key have differences in the data portion of the records
that do exist.
I have an "Algorithm" to determine which table is the authority on
each record, but its not simple and relies on what the data in the
rest of the record looks like

I suppose I am doing more of a Merge into a single authoritative copy,
then copy back out the result.


Marks answer works and I am using it but I can't help but feel like I
am missing a "*" or "&" or "ByRef" or "new" or something in the
language that would make my future life in this language easier.



Reply With Quote
  #7  
Old   
Jim Giner
 
Posts: n/a

Default Re: Array of TCursor - 01-15-2009 , 09:18 AM



I"m wondering why you need multiple tables if the data is all going to end
up in one and be similar again.
Why not have all the updates go to one central location, giving access to
fields to be updated only to those people that you want to update them.

I have to guess that certain people update certain fields, and other people
update other fields, etc. So - setup a form with all the fields on it and
then turn on the tab stops of each field for each user when he opens the
form, according to his "role" in using that form. Or - even simpler -
design separate forms that only allow input to specific fields and only
allow a user to open his particular form("view") to update data.

Or maybe you have something entirely more complex - in which case, good
luck!



Reply With Quote
  #8  
Old   
Dennis Santoro
 
Posts: n/a

Default Re: Array of TCursor - 01-15-2009 , 12:45 PM



It seems like you need to rethink the approach as the keeping of
synchronized data is largely what databases are about. You should be
able to have everyone working on the same master table or set up a check
out/check type of update system so that you can manage record updates
much more easily than trying to resynch a bunch of tables all edited
separately (although that can be done if there is a real need for it,
which there rarely is, it is way more complicated than managing things
directly).

It seems you could use some background on database management and on
paradox so let me suggest you read my papers on Normalization and
database basics at our paradox resources page (link in my signature).

Also, I may be remembering this incorrectly but I think you can assign
tcursors to dynarrays by creating a new type in uses. Search
thedbcommunity.com of the newsgruops at google for Type or defining type
and such and I think you will find info on that.

Denn Santoro
President
Resource Development Associates
http://www.RDAWorldWide.Com
Offices in the United States and Germany
Providing solutions to health care, business, governments and
non-profits since 1982

hswerdfe (AT) gmail (DOT) com wrote:

Quote:
I have about 10 tables
and by sync, yes I mean make them all identical

but there is no easy way to do this that I can see.
all the tables have some missing records and some other records that
have the same key have differences in the data portion of the records
that do exist.
I have an "Algorithm" to determine which table is the authority on
each record, but its not simple and relies on what the data in the
rest of the record looks like

I suppose I am doing more of a Merge into a single authoritative copy,
then copy back out the result.


Marks answer works and I am using it but I can't help but feel like I
am missing a "*" or "&" or "ByRef" or "new" or something in the
language that would make my future life in this language easier.

Reply With Quote
  #9  
Old   
Tony McGuire
 
Posts: n/a

Default Re: Array of TCursor - 01-15-2009 , 03:22 PM



Dennis Santoro wrote:
Quote:
Also, I may be remembering this incorrectly but I think you can assign
tcursors to dynarrays by creating a new type in uses. Search
thedbcommunity.com of the newsgruops at google for Type or defining type
and such and I think you will find info on that.

Denn Santoro
Nothing special needed for dynarray of tcursors. No Uses. No Type.
(How would you 'create a new type in uses', anyway?)


var
dyTC dynarray[] tcursor
endvar


is all it takes to get started.

---------------
Tony McGuire


Reply With Quote
  #10  
Old   
Dennis Santoro
 
Posts: n/a

Default Re: Array of TCursor - 01-15-2009 , 04:29 PM



Thanks Tony,

I new it could be done but I didn't have the time to look in my notes
and figured he would have tried something that obvious. Looking back ist
seems he sorta did but with an array and since there is no error
checking in his code we don't know where the error came from.

Denn Santoro
President
Resource Development Associates
http://www.RDAWorldWide.Com
Offices in the United States and Germany
Providing solutions to health care, business, governments and
non-profits since 1982

Tony McGuire wrote:
Quote:
Dennis Santoro wrote:
Also, I may be remembering this incorrectly but I think you can assign
tcursors to dynarrays by creating a new type in uses. Search
thedbcommunity.com of the newsgruops at google for Type or defining
type and such and I think you will find info on that.

Denn Santoro

Nothing special needed for dynarray of tcursors. No Uses. No Type.
(How would you 'create a new type in uses', anyway?)


var
dyTC dynarray[] tcursor
endvar


is all it takes to get started.

---------------
Tony McGuire

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.