Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

My scan isn't scannin'...?

 
   Database Help (Home) -> Paradox RSS
Next:  Calling CHM Help File From a Form  
Author Message
Kenneth

External


Since: Feb 12, 2008
Posts: 26



(Msg. 1) Posted: Wed Aug 13, 2008 12:20 pm
Post subject: My scan isn't scannin'...?
Archived from groups: comp>databases>paradox (more info?)

Howdy,

I am trying to write some code that is to compare records in
two tables. If it finds a particular record in one table but
does not find a slightly different record in the other
table, it is to do some stuff.

The tCursors open fine, but when I try to scan tCursor 2 it
seems not to increment.

I put in some view statements to try to sort things out, but
as I step through the code the same record number and phone
number keep displaying.

As I step through, I never get to DO STUFF. Instead, I am
returned to the line " ident = tc2."num" " without ident
having incremented.

The code could not be much simpler, but I can't spot the
problem:


scan tc2:
ident = tc2."num"
ident.view()
phone = tc2."info"
phone.view()

if (tc2.locate ("num", ident, "desc", "W") and
not (tc1.locate ("num", ident, "desc", "W1")))
then

;// DO STUFF

else
endIf
endScan


Many thanks for any help, as always,
--
Kenneth

If you email... Please remove the "SPAMLESS."

 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Jim Hargan

External


Since: Jun 07, 2008
Posts: 15



(Msg. 2) Posted: Wed Aug 13, 2008 1:12 pm
Post subject: Re: My scan isn't scannin'...? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In this line:
if (tc2.locate ("num", ident, "desc", "W") ...
the locate() moves your tCursor within the scan. The next time the scan
loops, it will take over from this new position. And this new position is
always the same position, as locate() always sends the tCursor to the first
matching record. So your scan gets stuck on one record.

Never move either the scanning tCursor or any records within a scan loop.

The scan should be sending tc2 straight to the correct records, as with:
scan tc2 for tc2."num" = ident and tc2."desc" = "W":
;do something
endscan
or else testing withing the scan, as with:
scan tc2:
if tc2."num" = ident and tc2."desc" = "W"
then ;do something
else loop
endif
endscan

--
Jim Hargan

On Wed, 13 Aug 2008 12:20:00 -0400, Kenneth wrote:

> Howdy,
>
> I am trying to write some code that is to compare records in
> two tables. If it finds a particular record in one table but
> does not find a slightly different record in the other
> table, it is to do some stuff.
>
> The tCursors open fine, but when I try to scan tCursor 2 it
> seems not to increment.
>
> I put in some view statements to try to sort things out, but
> as I step through the code the same record number and phone
> number keep displaying.
>
> As I step through, I never get to DO STUFF. Instead, I am
> returned to the line " ident = tc2."num" " without ident
> having incremented.
>
> The code could not be much simpler, but I can't spot the
> problem:
>
>
> scan tc2:
> ident = tc2."num"
> ident.view()
> phone = tc2."info"
> phone.view()
>
> if (tc2.locate ("num", ident, "desc", "W") and
> not (tc1.locate ("num", ident, "desc", "W1")))
> then
>
> ;// DO STUFF
>
> else
> endIf
> endScan
>
>
> Many thanks for any help, as always,

 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Kenneth

External


Since: Feb 12, 2008
Posts: 26



(Msg. 3) Posted: Wed Aug 13, 2008 1:28 pm
Post subject: Re: My scan isn't scannin'...? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 13 Aug 2008 13:12:21 -0400, Jim Hargan
wrote:

>In this line:
> if (tc2.locate ("num", ident, "desc", "W") ...
>the locate() moves your tCursor within the scan. The next time the scan
>loops, it will take over from this new position. And this new position is
>always the same position, as locate() always sends the tCursor to the first
>matching record. So your scan gets stuck on one record.
>
>Never move either the scanning tCursor or any records within a scan loop.
>
>The scan should be sending tc2 straight to the correct records, as with:
> scan tc2 for tc2."num" = ident and tc2."desc" = "W":
> ;do something
> endscan
>or else testing withing the scan, as with:
> scan tc2:
> if tc2."num" = ident and tc2."desc" = "W"
> then ;do something
> else loop
> endif
> endscan

Hi Jim,

Many thanks for the speedy and very helpful response...

But I am still not sure I correctly understanding how I
should set things up to do stuff only if something is found
in the first table, but not in the second.

Should that look something like this:

scan tc2:
If tc2."num" = ident and tc2."desc" = "W" and
not tc1.locate("num",ident,"desc",W1)
then

do something

All the best,
--
Kenneth

If you email... Please remove the "SPAMLESS."
 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Jim Giner

External


Since: Mar 14, 2008
Posts: 25



(Msg. 4) Posted: Wed Aug 13, 2008 1:57 pm
Post subject: Re: My scan isn't scannin'...? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Yes - you have it now. The scan will allow you to "see" all the records in
tc2. When you see one you like, you "locate" in the other table. If it's
not there, you "do stuff", otherwise I assume you just move on.
"Kenneth" wrote in message

> On Wed, 13 Aug 2008 13:12:21 -0400, Jim Hargan
> wrote:
>
>>In this line:
>> if (tc2.locate ("num", ident, "desc", "W") ...
>>the locate() moves your tCursor within the scan. The next time the scan
>>loops, it will take over from this new position. And this new position is
>>always the same position, as locate() always sends the tCursor to the
>>first
>>matching record. So your scan gets stuck on one record.
>>
>>Never move either the scanning tCursor or any records within a scan loop.
>>
>>The scan should be sending tc2 straight to the correct records, as with:
>> scan tc2 for tc2."num" = ident and tc2."desc" = "W":
>> ;do something
>> endscan
>>or else testing withing the scan, as with:
>> scan tc2:
>> if tc2."num" = ident and tc2."desc" = "W"
>> then ;do something
>> else loop
>> endif
>> endscan
>
> Hi Jim,
>
> Many thanks for the speedy and very helpful response...
>
> But I am still not sure I correctly understanding how I
> should set things up to do stuff only if something is found
> in the first table, but not in the second.
>
> Should that look something like this:
>
> scan tc2:
> If tc2."num" = ident and tc2."desc" = "W" and
> not tc1.locate("num",ident,"desc",W1)
> then
>
> do something
>
> All the best,
> --
> Kenneth
>
> If you email... Please remove the "SPAMLESS."
 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Jim Hargan

External


Since: Jun 07, 2008
Posts: 15



(Msg. 5) Posted: Wed Aug 13, 2008 2:22 pm
Post subject: Re: My scan isn't scannin'...? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Let's see if I get this right. You want to check each record in tc2's table
that has a "desc" of "W", and see if there is a record in tc1's table with
the same "num" and a "desc" of "W1". If, and only if, you find the tc1
record, you do something. Right? Then you are on the right track.

Perhaps,
scan tc2 for tc2."desc" = "W": ;possibly faster
if tc1.locate("num",tc2."num","desc","W1") then
;do something
endif
endscan

If tc1's table is indexed on "num" and "desc", and the index is named (say)
"byNumAndDesc", this would execute much faster:
tc1.switchIndex("byNumAndDesc")
scan tc2 for tc2."desc" = "W":
if tc1.qlocate(tc2."num","W1") then ;uses the index
;do something
endif
endscan

--
Jim Hargan

On Wed, 13 Aug 2008 13:28:10 -0400, Kenneth wrote:
> Hi Jim,
>
> Many thanks for the speedy and very helpful response...
>
> But I am still not sure I correctly understanding how I
> should set things up to do stuff only if something is found
> in the first table, but not in the second.
>
> Should that look something like this:
>
> scan tc2:
> If tc2."num" = ident and tc2."desc" = "W" and
> not tc1.locate("num",ident,"desc",W1)
> then
>
> do something
>
> All the best,

> On Wed, 13 Aug 2008 13:12:21 -0400, Jim Hargan
> wrote:
>
>>In this line:
>> if (tc2.locate ("num", ident, "desc", "W") ...
>>the locate() moves your tCursor within the scan. The next time the scan
>>loops, it will take over from this new position. And this new position is
>>always the same position, as locate() always sends the tCursor to the first
>>matching record. So your scan gets stuck on one record.
>>
>>Never move either the scanning tCursor or any records within a scan loop.
>>
>>The scan should be sending tc2 straight to the correct records, as with:
>> scan tc2 for tc2."num" = ident and tc2."desc" = "W":
>> ;do something
>> endscan
>>or else testing withing the scan, as with:
>> scan tc2:
>> if tc2."num" = ident and tc2."desc" = "W"
>> then ;do something
>> else loop
>> endif
>> endscan
>
 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Kenneth

External


Since: Feb 12, 2008
Posts: 26



(Msg. 6) Posted: Wed Aug 13, 2008 2:25 pm
Post subject: Re: My scan isn't scannin'...? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 13 Aug 2008 13:57:23 -0400, "Jim Giner"
wrote:

>Yes - you have it now. The scan will allow you to "see" all the records in
>tc2. When you see one you like, you "locate" in the other table. If it's
>not there, you "do stuff", otherwise I assume you just move on.
>"Kenneth" wrote in message
>
>> On Wed, 13 Aug 2008 13:12:21 -0400, Jim Hargan
>> wrote:

Hi again Jim,

Many thanks!!
--
Kenneth

If you email... Please remove the "SPAMLESS."
 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Jim Giner

External


Since: Mar 14, 2008
Posts: 25



(Msg. 7) Posted: Wed Aug 13, 2008 3:03 pm
Post subject: Re: My scan isn't scannin'...? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> Hi again Jim,
>
Different Jim - but the answer hopefully is just as good. Smile
 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Kenneth

External


Since: Feb 12, 2008
Posts: 26



(Msg. 8) Posted: Thu Aug 14, 2008 7:35 am
Post subject: Re: My scan isn't scannin'...? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 13 Aug 2008 15:03:48 -0400, "Jim Giner"
wrote:

>> Hi again Jim,
>>
>Different Jim - but the answer hopefully is just as good. Smile
>

My thanks to all Jims, it worked just fine.

I had about 5000 records to from which some phone
information had to be "moved" under certain conditions. One
click, and the deed was done.

All the best,
--
Kenneth

If you email... Please remove the "SPAMLESS."
 >> Stay informed about: My scan isn't scannin'...? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
write to paradox via web - I have a client that uses software developed in delphi. It uses paradox database files. Can these be written to from the web? I am familiar with php/mysql...is there a similar capability with delphi/paradox?

which program? - Hi to all, I'm sorry 'cause I'm not sure this is the correct ng...so my apologies in advance if I'm in the wrong place. My customer show me a floppy disk with old files (about 1998-1999) and told me that there are her accounting data to back life. With...

forcing lck files location - Is there method to force lck files location. I create query on fly with Delphi but there is a problem with lock files. It tries to create it to system32 folder but because user does not have rights to that folder , creating query fails. So, how can I..

Network performance and hardware issues - Hi! Our clients have run our Paradox based apps in small network configurations with only about 10-15 runtime clients at max. Recently we have had inquiries from a bigger company that wants to run our app in an network of over 100 clients, is this..

I can't to open table(s) on InterBase's server - I have a computer with OS WindowsXP Professional version 2002 with SP2 and I have next problem with Paradox 10 v.11.0.0.302. I can't to open a table(s) on InterBase's server, but I can to open a local table(s). Dialog window of Database Login for..
   Database Help (Home) -> Paradox All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]