Paradox Community

Items in pnews.paradox-programming

Subject:Re: Help with writing tcursor
Date:20 May 2020 20:27:46 -0400
From:"Kevin Zawicki" <numberjack@wi.rr.com>
Newsgroups:pnews.paradox-programming

There are many ways to do this.


Use 2 tcursors.

Pseudo code , not tested. Add error checking, etc.


Var
 dstTC,  ;//destination
 srcTC   tcursor    ;//source
 fldVar string
endvar


dstTC.open(“CT2.db”)
dstTC.edit()

srcTC.open(“CT1.db”)

scan srcTC:
 if dstTC.locate(“MainID”,srctTC.”MainID”)
  fldVar = srcTC.”Month”
  dstTC. setFieldValue(fldVar, srctTC.”Total”) 
 dstTC.unlockrecord()
 endif
endscan

dstTC.close()
srctC.close()

or you could scan the dst and locate each month while filtering on mainID,
look at cross tabbing, 


Depends on the context an what might take longer.

Also, if possible and keyed, make MainID field a longInt.




Kevin Baker <shcsbaker@gmail.com> wrote:
>
>If you look at the attached picture, I'm trying to update CT1.DB with 
>the info from CT2.DB.  I've been trying to do this with 12 different 
>queries, which works somewhat.  I get errors and some GPV, so was 
>looking to see if this was possible by using a tcursor.
>
>I'm thinking if may require a tc.locate and not sure if doing a locate 
>with a tc is recommended.
>
>Any help is very much appreciated.
>


Copyright © 2004 thedbcommunity.com